phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Push Notification not received Android #1304

Closed amitdangwal closed 8 years ago

amitdangwal commented 8 years ago

Android 5.1 (Moto G) AppTemplate taken from phonegap push notification phonegap create my-app --template phonegap-template-push Adobe Phonegap Build CLI 6.3.0

In config.xml and index.js, I have replaced the XXXXXX with Correct Sender ID.

I am trying to use this plugin. 2 issues I am facing:

  1. On android, I do not see the Push notification acceptance Prompt, "App" Would like to Send you notifications, Allow, Don'w Allow.
  2. When I try to send a message, notification event is not getting fired. There is no error being thrown (debugging through Gapdebug). Registration Event is getting fired and registration id is getting generated but no notification being receive("On" not getting invoked). I have tried to send message from FCM send notification as well as from below one phonegap push --deviceID fa-cclyOrEU:APA911234_-ojdO1233eocH4p7rSgVZIlkPdmGkbepsjuQpx1234Tk31234VjXDl1234_QIKhVU82-lyF8Xbnzq52hmBTGakEd7v-Vvr9dN8Djta0NgTF4TArvspBmTpJaMu1W24rgf --service gcm --payload '{ "data": { "title": "Hello", "message": "World"} }'

    got response as "body: OK" but still message is not received. FCM notification window shows Message sending completed.

    Kindly guide as what is missing.

macdonst commented 8 years ago

Currently do not support FCM, see issue #929

amitdangwal commented 8 years ago

@macdonst, sincere thanks to you for the inputs. I have tried GCM too and it is not working. In my previous response I have sent the GCM command along with attempt of sending notification through FCM UI. I understand FCM not supported but it is not responding to GCM. Before trying this push notification plugin I was using an outdated plugin from PGB build for sending notifications to ios and android using GCM, APNS and it is working till CLI 5.2. I am moving toward new CLI 6.3 as from November old plugin support will end.

I may be missing something about this plugin. App is taken as it is from the template phonegap-template-push. I have tried winere, gapdebug, phonegap developer to listen for event "Notification"( push.on('notification', function(data) ) but it is not hitting it and no notifications are appearing. Screenshot attached(debugger added in push.on('notification', but never hit)

Point 1) Will it show the Push Notification prompt in Android ? It does shows that in iOS As per documentation it will show but it is not showing. So is this a bug? http://docs.phonegap.com/develop/push-notifications/

Point 2) Here is GCM attempts and still no message received.

phonegap push --deviceID fNs4ddtdAm8:APA91bFY-EojwPaDgVBATDX8snrnf1Mx2mi-Iutgpg0up-5kAa8falfwEcFeCCBsp8a8aw7Vfm5KTVh9f2o0EVyQwILtMTCkIfUNZSSlVbg11YIDXgQyQ3hme354OQUkc2v3W7HdqBqW --service gcm --payload '{ "data": { "title": "Hello", "message": "World"} }'

body: OK

The only scenario notification message are received when I run the app through phonegap develop app and send the phonegap push. If I build the android app using adobe Phonegap cli 6.3 then it is not receiving message.

I am suspecting some issue with registration id as it seem to getting changed as the below command tells that the registration id is invalid. I am using correct sender ID. Please guide me. Do I need to try any specific version of plugin? I have not given any version in config and let it pick the latest. I understand people are using it and it might be working for them but where it is gettin stuck for me is not clear and I need your assistence.

$ curl --header "Authorization: key=MYKEY" --header "Content-Type: application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"fNs4ddtdAm8:APA91bFY-EojwPaDgVBATDX8snrnf1Mx2mi-Iutgpg0up-5kAa8falfwEcFeCCBsp8a8aw7Vfm5KTVh9f2o0EVyQwILtMTCkIfUNZSSlVbg11YIDXgQyQ3hme354OQUkc2v3W7HdqBqW \"], \"data\": { \"message\": \"This is a GCM Topic Message!\", }}"

{"multicast_id":7236890165229808725,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}

screen shot 2016-10-21 at 2 57 52 pm screen shot 2016-10-21 at 2 12 46 pm

Thank You, Amit Dangwal

amitdangwal commented 8 years ago

Can you please reopen this issue?

lock[bot] commented 6 years ago

This thread has been automatically locked.