PushNotificationSample
PushNotificationSample copied to clipboard
Android platform?
Great Example, does this also support Android?
Working on it, should be done by end of week :)
HI We are using this example for android, During registration request is being sent we get success to, But for some reason pushNotificationReceived event is not getting fired. Also getting following log -
W/ActivityManager(384): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) } U=0: not found
Can you help me in this issue ?
I really don't know what to do. +1? When I click REGISTER it says "registered for push notifications", but nothing happens, no device token is shown.
Have you checked the log to see if there are messages? You can run adb logcat
from the command line (part of the android tools) in another window to see all the trace of what's happening to see the resulting messages.
Here is the log:
I/chromium(18388): [INFO:CONSOLE(27)] "Register success OK", source: http://192.168.25.4:8100/ (27) I/GCM (21881): GCM config loaded I/SFPerfTracer( 304): triggers: (rate: 0:54) (58070 sw vsyncs) (0 skipped) (157:531598 vsyncs) (159:728930) V/GCMBroadcastReceiver(18388): onReceive: com.google.android.c2dm.intent.REGISTRATION V/GCMBroadcastReceiver(18388): GCM IntentService class: com.plugin.gcm.GCMIntentService V/GCMBaseIntentService(18388): Acquiring wakelock V/GCMBaseIntentService(18388): Intent service name: GCMIntentService-GCMIntentService-3 D/GCMBaseIntentService(18388): handleRegistration: registrationId = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, error = null, unregistered = null D/GCMRegistrar(18388): resetting backoff for com.ionicframework.rockpush736254 V/GCMRegistrar(18388): Saving regId on app version 1 V/GCMIntentService(18388): onRegistered: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx V/GCMIntentService(18388): onRegistered: {"event":"registered","regid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} V/PushPlugin(18388): sendJavascript: javascript:angular.element(document.querySelector('[ng-app]')).injector().get('$cordovaPush').onNotification({"event":"registered","regid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}) V/GCMBaseIntentService(18388): Releasing wakelock
I have even managed to send me push notifications, but I could not run the notificationReceived function, to save the user on pushserver.
ps: I have changed my regId to xxxxxxxxxxxxxxxxxxxx
My steps where: 1- I have created my own app with "ionic start .." 2- I have added the android platform 3- I have added every plugin as showed. 4- I have edited the controller to add my GCM id and my local server (that was already running the pushserver). 5- I have ran the app in my device with ionic run android.
Thats is pretty much it. Thank you so much for your attention!
Hey @hollyschinsky, I managed to make it work on android by undoing this commit: https://github.com/hollyschinsky/PushNotificationSample/commit/be49d3854e48346da0173ba0da4a369827dc6541
Ok... had to update ng-cordova and it then worked! Thanks
@hollyschinsky can you explain me the functionality of services.js? including this file is removing every view on my app.