Closed EnricoOri closed 8 years ago
Hi, I'm having the same issue. @dlockh3ll Why was this issue closed?
Mine does subscribe successfully to the interest though. onMessageReceived is just never called
@dlockh3ll Please respond, I'm really struggling with this issue. Did you get it to work in the end?
@LaurieScheepers Sorry for the late response, i was not paying attention to Github these days. I got it to work changing the push method to Firebase (so not GCM) and by NOT using the "onMessageReceived" method but receiving the messages on a custom receiver that could get the "firebase message" intent filter. I think this approach will work also with GCM, just don't use the "onMessageReceived" but override a BroadcastReceiver and replace in the manifest the one i wrote above (with the same intent-filters, permissions etc.)
this android:name="com.google.android.gms.gcm.GcmReceiver" to android:name="com.yourapp.YourGCMReceiver"
This approach works with Firebase (even if the actual push delivery is handled differently compared to GCM), so I think you can use it also with GCM. I suggest you anyway to check GCM docs to properly handle received messages.
Hope it will help, and sorry for my bad english :-)
@dlockh3ll Thanks so much! The custom broadcast receiver approach works, but I can't believe that this is necessary for it to work! It seems the setGcmListener() only works when the app is active (which totally destroys the point of Pusher push notifications). I guess there's a reason why this library is only v0.5. Cmon Pusher guys, get your act together.
Here are the things I tried before you replied: Stripped out Localytics and Parse libraries (which also contain a GcmListenerService), made a custom GcmListenerService, smashed some windows, swore at my neighbour etc. all without success.
Thanks again!
@LaurieScheepers You are welcome 👍 Yes, it's pretty useless to have a push library which receives push notifications only when the app is active XD.
Agreed. WTF
On my onCreate method i use this static method to register for push (using GCM), which i configured following the guide on the website.
My Manifest (package name is COM.MYAPP) has:
Then in the onCreate of my Main activity i call this method.
All callbacks result are ok but i can't retreive any push notification, the onMessageReceived is never fired up. It looks like it doesen't subscribe to the topic "CONF.PUSH_SUBSCRIPTION" We have also an iOS app configured the same way (with the same "interest") and there notifications arrive without any problem. Even tried configuring with Firebase, registration goes all right but I can get any push notification.