How to implement multiple GCM push notifications in one application?

I am trying to implement two third-party libraries (Parse & Localytics) that uses GCM push notifications, but I cannot get both to work together. This is either one or the other that will work.

 <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </receiver> <receiver android:name="com.localytics.android.PushReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </receiver> 
+6
source share
1 answer

GCM only knows your application, not the contents of the GCM payload.

You need a general receiver that can analyze the intent obtained for specific data, which identifies it as โ€œLocalsโ€ or โ€œAnalysisโ€, then redirects that intent to the appropriate recipient for any service.

GCM is based on "registering applications" not on "registering application functions" - it will be delivered to your application, not to a specific recipient in your application.

+3
source

Source: https://habr.com/ru/post/984534/


All Articles