[英]Push notification in Android and Phonegap
I am searching for push notification in Android applications. 我正在Android应用程序中搜索推送通知。 I checked " Pushwoosh ": in the
initPushwoosh
method I saw GOOGLE_PROJECT_ID
and PUSHWOOSH_APP_ID
. 我检查了“ Pushwoosh ”:在
initPushwoosh
方法中,我看到了GOOGLE_PROJECT_ID
和PUSHWOOSH_APP_ID
。
function initPushwoosh() {
var pushNotification = window.plugins.pushNotification;
pushNotification.registerDevice(
{
projectid: "GOOGLE_PROJECT_ID",
appid : "PUSHWOOSH_APP_ID"
},
function(status) {
var pushToken = status;
console.warn('push token: ' + pushToken);
},
function(status) {
console.warn(JSON.stringify(['failed to register ', status]));
}
);
document.addEventListener('push-notification', function(event) {
var title = event.notification.title;
var userData = event.notification.userdata;
if(typeof(userData) != "undefined") {
console.warn('user data: ' + JSON.stringify(userData));
}
navigator.notification.alert(title);
});
}
How can I get these two IDs? 如何获得这两个ID? Or is there any better way to do this?
或者有更好的方法吗?
i saw Notification in PhoneGap documentation, Is it push notification? 我在PhoneGap文档中看到了Notification,它是推送通知吗?
Thank you. 谢谢。
These are the steps you must do: 这些是您必须执行的步骤:
GOOGLE_PROJECT_ID
from the URL in your Google API console. GOOGLE_PROJECT_ID
。 Usually it looks like this: https://code.google.com/apis/console/#project:12345678912:access In this example, it would be: 12345678912 My Apps
menu My Apps
菜单 PUSHWOOSH_APP_ID
PUSHWOOSH_APP_ID
Phonegap's Notification has nothing to do with push notification. Phonegap的通知与推送通知无关。 Check it here: http://docs.phonegap.com/en/2.2.0/cordova_notification_notification.md.html#Notification
请在此处查看: http : //docs.phonegap.com/en/2.2.0/cordova_notification_notification.md.html#Notification
To integrate Pushwoosh for Android with Phonegap check the manual: http://www.pushwoosh.com/programming-push-notification/android-gcm-push-notifications-guide/ 要将Pushwoosh for Android与Phonegap集成,请查看手册: http ://www.pushwoosh.com/programming-push-notification/android-gcm-push-notifications-guide/
On this page are more guides for using Pushwoosh: 在此页面上,有更多使用Pushwoosh的指南:
http://www.pushwoosh.com/programming-push-notification/ http://www.pushwoosh.com/programming-push-notification/
Goodluck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.