Do not receive push notifications from GCM (Android)

I use the link to check my push notifications. He did a great job last night, woke up this morning, and I no longer receive push notifications. I tested it before writing new code. The device used for testing is Samsung Galaxy S5, the OS is Lollipop.

Here is my manifest, let me know if you need to see any of my services.

<permission android:name=".permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name=".permission.C2D_MESSAGE" /> <application .... .... <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.fullpackage.name.gcm" /> </intent-filter> </receiver> <service android:name=".services.MyGcmListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </service> <service android:name=".services.MyInstanceIDListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.gms.iid.InstanceID" /> </intent-filter> </service> 

I am not getting any errors and it says the message was sent successfully from my server and this test link above. I tried to remove the application and create a new token, and it still does not work. I can also get my token successfully every time I download the application.

+3
source share
1 answer

Look at the official official textbook . You seem to have skipped to add the package name to the permissions.

 <permission android:name="your.package.name.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="your.package.name.permission.C2D_MESSAGE" /> 

Also, the sources of your MyGcmListenerService and MyInstanceIDListenerService will be useful for help (how you get and process the token, etc.).

Or, if you say that it worked well yesterday, try turning on and then turning off airplane mode or restarting the phone.

+3
source

Source: https://habr.com/ru/post/1234964/


All Articles