New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: No notification displayed on device. Notification event never called. #86

Closed
greg84 opened this Issue Aug 30, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@greg84

greg84 commented Aug 30, 2015

I've made a blank Cordova application and copied the files from example/www, I've added the push plugin using cordova plugin add phonegap-plugin-push. I've set up a GCM Server API key using the Google Developer Console, I've also created a project on there and copied the project ID to use as the sender ID.

I'm only trying to test the plugin with Android at the moment.

The app starts, after a few seconds it displays the registration ID. I copy it into an email and send it to myself. I paste that into a PushSharp application and send a test notification. Using Fiddler I can see the HTTP request to GCM and it comes back with a "success" response:

{
"multicast_id":8315002763252161845,
"success":1,
"failure":0,
"canonical_ids":0,
"results":[{"message_id":"0:1440926514632760%c7a19b3bf9fd7ecd"}]
}

In LogCat I can see the message is received on the device, but it isn't displayed in the notification area when the app is the background and the notification event is not called. If the app is in the foreground, still the notification event never gets called.

This is the output from the the Android Device Monitor when the message is received:

08-30 11:47:30.009: I/GCM(1513): GCM message uk.co.airis.test1 0:1440926514632760%c7a19b3bf9fd7ecd
08-30 11:47:30.019: D/PMS(651): acquireWL(37389d8): PARTIAL_WAKE_LOCK  GOOGLE_C2DM 0x1 1513 10024 WorkSource{10024 com.google.android.gms}
08-30 11:47:30.039: V/GCMBroadcastReceiver(2515): onReceive: com.google.android.c2dm.intent.RECEIVE
08-30 11:47:30.049: D/PMS(651): acquireWL(2141b131): PARTIAL_WAKE_LOCK  GCM_LIB 0x1 2515 10429 null
08-30 11:47:30.039: V/GCMBroadcastReceiver(2515): GCM IntentService class: com.adobe.phonegap.push.GCMIntentService
08-30 11:47:30.059: D/PMS(651): releaseWL(37389d8): PARTIAL_WAKE_LOCK  GOOGLE_C2DM 0x1 WorkSource{10024 com.google.android.gms}
08-30 11:47:30.039: V/GCMBaseIntentService(2515): Acquiring wakelock
08-30 11:47:30.069: D/PMS(651): releaseWL(15ae50bb): PARTIAL_WAKE_LOCK  GCM_CONN 0x1 WorkSource{10024 com.google.android.gms}
08-30 11:47:30.069: V/GCMBaseIntentService(2515): Intent service name: GCMIntentService-GCMIntentService-2
08-30 11:47:30.079: D/PMS(651): releaseWL(2141b131): PARTIAL_WAKE_LOCK  GCM_LIB 0x1 null
08-30 11:47:30.079: D/PushPlugin_GCMIntentService(2515): onMessage - context: android.app.Application@21ebb732
08-30 11:47:30.079: D/PushPlugin(2515): key = from
08-30 11:47:30.079: D/PushPlugin(2515): key = alert
08-30 11:47:30.079: D/PushPlugin(2515): key = badge
08-30 11:47:30.079: D/PushPlugin(2515): key = sound
08-30 11:47:30.079: D/PushPlugin(2515): key = collapse_key
08-30 11:47:30.079: D/PushPlugin(2515): key = foreground
08-30 11:47:30.079: V/PushPlugin(2515): extrasToJSON: {"count":"7","sound":"sound.caf","additionalData":{"from":"1073101386075","alert":"Test notification","collapse_key":"do_not_collapse","foreground":true}}
08-30 11:47:30.079: V/GCMBaseIntentService(2515): Releasing wakelock

I'm not sure what else I need to do to get this to work, or whether it's a bug?

@greg84

This comment has been minimized.

Show comment
Hide comment
@greg84

greg84 Aug 30, 2015

Well I've just worked this out! I was passing an "alert" value for the message to GCM (as per PushSharp documentation), but it should have been called "message".

greg84 commented Aug 30, 2015

Well I've just worked this out! I was passing an "alert" value for the message to GCM (as per PushSharp documentation), but it should have been called "message".

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot Jun 5, 2018

This thread has been automatically locked.

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.