'Is com.google.android.c2dm.intent.RECEIVE still in use?
I've seen that c2dm itself is deprecated. But the new method, Google Cloud Messaging, seems to send intents with com.google.android.c2dm.intent.RECEIVE as the action.
My code is using this to get the registration key:
gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
gcm.register(SENDER_ID);
Things are arriving correctly, but I'm wondering if I've left something in a half-deprecated state.
Solution 1:[1]
the com.google.android.c2dm.intent.RECEIVE is also used by the firebase cloud messaging
Solution 2:[2]
As for the Receiver declaration
<receiver
android:name=".GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
</intent-filter>
</receiver>
Google suggested to replace BroadcastReceiver with the com.google.android.gms.gcm.GcmReceiver, just like below.
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
</intent-filter>
</receiver>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mahdi-Malv |
| Solution 2 | Zephyr |
