I am searching for push notification in Android applications. I checked "Pushwoosh": in the initPushwoosh
method I saw GOOGLE_PROJECT_ID
and 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? Or is there any better way to do this?
i saw Notification in PhoneGap documentation, Is it push notification?
Thank you.
Phonegap's Notification has nothing to do with push notification. Check it here: 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/
On this page are more guides for using Pushwoosh:
http://www.pushwoosh.com/programming-push-notification/
Goodluck!
These are the steps you must do:
- First you must register in Google APIs site, select Services: https://code.google.com/apis/console/
- Turn the Google Cloud Messaging toggle to ON
- In the Terms of Service page, accept the terms.Now you need to create the Server Key
- Press “API Access” button
- Press “Create new Server key”. Either a server key or a browser key should work. The advantage to using a server key is that it allows you to whitelist IP addresses.
- Press “Create”.
- You can find your
GOOGLE_PROJECT_ID
from the URL in your Google API console. Usually it looks like this: https://code.google.com/apis/console/#project:12345678912:access In this example, it would be: 12345678912
- Enter in Pushwoosh copanel: https://cp.pushwoosh.com/
- Create or enter in
My Apps
menu
- When you enter into an app you'll see the Application code in that page or in the navigator's url and this will be your
PUSHWOOSH_APP_ID