2

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.

Viswa
  • 3,211
  • 5
  • 34
  • 65

2 Answers2

5

These are the steps you must do:

  1. First you must register in Google APIs site, select Services: https://code.google.com/apis/console/
  2. Turn the Google Cloud Messaging toggle to ON
  3. In the Terms of Service page, accept the terms.Now you need to create the Server Key
  4. Press “API Access” button
  5. 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.
  6. Press “Create”.
  7. 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
  8. Enter in Pushwoosh copanel: https://cp.pushwoosh.com/
  9. Create or enter in My Apps menu
  10. 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
mram888
  • 4,899
  • 5
  • 33
  • 59
2

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!

weerd2
  • 690
  • 1
  • 5
  • 18
  • thanks, what is the use of pushwoosh remote api? because i can't access it using free account – Viswa Nov 19 '12 at 09:07
  • 1
    That's right, you must at least have a Premium Account: http://www.pushwoosh.com/accounts-comparison/ Using the remote api you can send custom data with the remote api request, e.g. you can send notifications to specific devices. Goodluck! – weerd2 Nov 19 '12 at 09:30
  • is there any open source for push notification? – Viswa Nov 19 '12 at 09:40
  • without remote api can i send push notification?, i did't understood what is the different between with api and without api – Viswa Nov 19 '12 at 09:47
  • 2
    Yes you can, but you have to write and send them yourself. Like in this screenshot: http://www.pushwoosh.com/wp-content/uploads/2011/06/screenshot-20120730-1.png With the remote api you can arrange this on your server. – weerd2 Nov 19 '12 at 10:27
  • is there any open source for push notification? – Viswa Nov 20 '12 at 04:29
  • There is [Google Cloud Messaging](http://developer.android.com/guide/google/gcm/index.html) for Android and [Apple Push Notification Service](http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html) for iOS which are free to use. Regarding cross-platform products (like Pushwoosh) I don't know if there are any open source versions. I guess Google knows the answer;) Good luck whit it! – weerd2 Nov 20 '12 at 08:42