java - Why am I getting intent.REGISTRATION with Google Cloud Messaging -
i have been trying implement gcm android app. however, after following tutorial http://developer.android.com/google/gcm/client.html
i'm getting intent type registration "unregistered" although expect data. @ start of app i'm registering without problem , receive registration id send server. use amazon sns.
broadcastreceiver , intentservice in separate package inside main package.
manifest:
package="my.main.package"> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <uses-permission android:name="com.google.android.c2dm.permission.register" /> <uses-permission android:name="my.main.package.permission.c2d_message" /> <permission android:name="my.main.package.permission.c2d_message" android:protectionlevel="signature" /> <receiver android:name=".gcm.fdgcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <action android:name="com.google.android.cd2m.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="my.main.package" /> </intent-filter> </receiver> <service android:name=".gcm.fdgcmintentservice"/>
broadcast receiver:
public class fdgcmbroadcastreceiver extends wakefulbroadcastreceiver { private static final string tag = "fdgcmbroadcastreceiver"; @override public void onreceive(context context, intent intent) { log.i(tag, "on receive, " + intent.getaction()); // explicitly specify gcmintentservice handle intent componentname componentname = new componentname(context.getpackagename(), fdgcmintentservice.class.getname()); // start service, keeping device awake while launching startwakefulservice(context, intent.setcomponent(componentname)); setresultcode(activity.result_ok); } }
what doing wrong?
eran's answer here answers issue.
in step 2 of gcm doc linked, com.google.android.c2dm.intent.registration
not among intent-filter actions include in manifest file.
Comments
Post a Comment