I have a chrome Apps use push notification of GCM. I have a problem, when i don't login account on chrome. I can't receive registerId from GCM. I think a idea. When registerId empty, i show notification, request user login to chrome and show login page account on chrome. But because of security concerns , the chrome does not allow access to its setting from external links . How is open "chrome://settings/" from external links? Can register to gcm, If i don't want login account on chrome?
My code:
function setValue()
{
//var thongtin=$('#status').val();
//var thongtin = document.getElementById('status').innerText;
if(registrationId == "")
{
// Pop up a notification to show notification.
chrome.notifications.create(getNotificationId(), {
title: 'CLOUD MONITOR',
iconUrl: 'gcm_128.png',
type: 'basic',
message: 'You must sign in account gmail on google chrome!'
}, function() {});
//event click to notification
chrome.notifications.onClicked.addListener(function() {
window.location.href = "chrome://settings/"
});
}
else
{
//http://ift.tt/1tagI1K" +registrationId+"&device=android
//document.getElementById('webviewSendData').src = "http://ift.tt/13KJES4" +registrationId+"&DEVICE=desktop";
document.getElementById('webviewSendData').src = "http://ift.tt/1tagI1K"+registrationId+"&device=android";
//document.getElementById('webviewSendData').src = "http://ift.tt/1tagI1M" +registrationId+"&device=android";
//var url = "http://ift.tt/1tagI1M" +registrationId+"&device=android";
//httpGet(url);
//alert(thongtin);
//document.getElementById('status').innerHTML="Infomation New";
// Pop up a notification to show notification.
}
}
This code don't run.
chrome.notifications.onClicked.addListener(function() {
window.location.href = "chrome://settings/"
});
Aucun commentaire:
Enregistrer un commentaire