Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is com.google.android.c2dm.intent.REGISTRATION deprecated?

Short version: is the intent com.google.android.c2dm.intent.REGISTRATION still used at all or has it been completely deprecated by GCM?

Longer version: Google's gcm-demo-client declares this intent in its filter, however, if I follow the same procedure, I get a valid registration id when I call gcm.register() and then, my broadcast receiver receives an additional registration id because of the REGISTRATION filter, and this second registration id is bogus (I can't send any notification to it).

At this point, I'm considering removing the REGISTRATION filter (and keeping just RECEIVE) but I want to make sure I'm not missing something important in the protocol.

like image 274
Cedric Beust Avatar asked Mar 06 '14 07:03

Cedric Beust


People also ask

What is com Google Android C2DM?

Android Cloud to Device Messaging (commonly referred to as Cloud to Device Messaging), or C2DM, is a defunct mobile notification service that was developed by Google and replaced by the Google Cloud Messaging service. It enabled developers to send data from servers to Android applications and Chrome extensions.

What is C2DM permission?

android. c2dm. permission. RECEIVE – Grants permission to our app to register and receive messages from Google Cloud Messaging.

What is GCM service on Android?

Google Cloud Messaging (GCM) for Android is a service that allows you to send data from your server to your users' Android-powered device and also to receive messages from devices on the same connection.


3 Answers

You risk not receiving registration IDs for a small percentage of your users.

https://blog.pushbullet.com/2014/02/12/keeping-google-cloud-messaging-for-android-working-reliably-techincal-post/

Lesson #2: Be ready for register to repeatedly fail on some devices even though a working registration ID is created.

This tip is rather bizarre and may no longer be relevant but I have no way of confirming if the bug in GCM has been fixed so here it is.

The bug goes like this: no matter how many times you call register, it will always fail and throw an exception on some devices. Even though register is throwing an exception, a working registration ID is being created but not returned. To get this registration ID, add this permission to your GCM BroadcastReceiver’s IntentFilter:

<action android:name="com.google.android.c2dm.intent.REGISTRATION" />

Gotta love GCM. =)

like image 169
Elad Nava Avatar answered Oct 02 '22 13:10

Elad Nava


Even for the latest GCM version (aka GCM 3) the official GCM documentation warns about the need of this permission for push support on old devices:

If you want to support pre-4.4 KitKat devices, add the following action to the intent filter declaration for the receiver: <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

like image 32
gauchofunky Avatar answered Oct 02 '22 12:10

gauchofunky


You are probably looking at an older version of the official Google demo. The current version doesn't use com.google.android.c2dm.intent.REGISTRATION, as you can see here:

    <receiver
        android:name=".GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.google.android.gcm.demo.app" />
        </intent-filter>
    </receiver>
like image 20
Eran Avatar answered Oct 02 '22 14:10

Eran