Reputation: 69
My menifest permission is below code
<permission
android:name="com.xyz.xyz.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE"/>
this is the crash
Caused by java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1794) at android.app.ContextImpl.startService(ContextImpl.java:1771) at android.content.ContextWrapper.startService(ContextWrapper.java:521) at com.google.android.gms.iid.zzc.zzb(Unknown Source) at com.google.android.gms.iid.zzc.zza(Unknown Source) at com.google.android.gms.iid.zzc.zzb(Unknown Source) at com.google.android.gms.iid.zzc.zza(Unknown Source) at com.google.android.gms.iid.InstanceID.zzc(Unknown Source) at com.google.android.gms.iid.InstanceID.getToken(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
Upvotes: 0
Views: 235
Reputation: 159
Try this in your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to wakeup the device and deliver messages -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="your_package.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="your_package.permission.C2D_MESSAGE"/>
Upvotes: 0
Reputation: 1732
Have you followed official tutorial ? Apart from your receiver (which is not clear from your quoted part of manifest) you'd need to grant permissions to SDK's receiver, i.e.
<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="<your-package-name>" />
</intent-filter>
</receiver>
Upvotes: 0