G. Hamaide
G. Hamaide

Reputation: 7106

Android push notifications, not granting permission

I'm trying to enable notifications on my android app (built in react-native) using this package

Here is a part of my MANIFEST.XML file :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="{package_name}"
 android:versionCode="1"
 android:versionName="1.0.0"
 android:minSdkVersion="21"
 android:targetSdkVersion="23">

<permission
    android:name="com.xxx.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.xxx.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.SEND" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_TASKS" /> 

...

<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.xxx" />
  </intent-filter>
</receiver>
<service android:name="com.oney.gcm.GcmRegistrationService"/>
<service android:name="com.oney.gcm.BackgroundService"></service>

<service
  android:name="com.oney.gcm.RNGcmListenerService"
  android:exported="false" >
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  </intent-filter>
</service>
<receiver
  android:exported="false"
  android:name="com.oney.gcm.GcmBroadcastReceiver">
  <intent-filter>
    <action android:name="com.oney.gcm.GCMReceiveNotification" />
    </intent-filter>
</receiver>

<receiver android:name="io.neson.react.notification.NotificationEventReceiver" />
<receiver android:name="io.neson.react.notification.NotificationPublisher" />
<receiver android:name="io.neson.react.notification.SystemBootEventReceiver">
  <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED"></action>
  </intent-filter>
</receiver>

Unfortunately, I have this in my logs when I install my app :

W/PackageManager( 873): Not granting permission com.google.android.c2dm.permission.SEND to package (protectionLevel=18 flags=0x8be46)

Any thoughts on the issue ?

Thanks.

Upvotes: 0

Views: 812

Answers (2)

Mina Fawzy
Mina Fawzy

Reputation: 21452

I think because you are using deprecated api

Important: C2DM was officially deprecated on June 26, 2012, and will be shut down completely as of October 20, 2015. Existing C2DM developers are encouraged to migrate to Google Cloud Messaging (GCM). See the C2DM-to-GCM Migration document for more information. Developers must use GCM for new development.

https://developers.google.com/android/c2dm/?csw=1#manifest

Upvotes: 0

CandleCoder
CandleCoder

Reputation: 1503

There is a C2DM setup issue at your project level.Either go through official doc or follow this tutorial step by step.

Step to be made while changing your Manifest.xml

  • Permission to receive C2DM messages
  • Access to the internet
  • Restrict access to your C2DM messages so no other app can see them
  • Declare a Receiver, that we’ll create later, that will let us receive the C2DM events
  • Make sure that the minSdkVersion is set so that only 2.2 and higher can access your app

Upvotes: 1

Related Questions