GCM Push Notification Not Revived

后端 未结 2 377
心在旅途
心在旅途 2020-12-12 04:10

Below you can find the manifest file, is their anything wrong with configuration of GCM push notification classes ?

no notification is received at all on an

相关标签:
2条回答
  • 2020-12-12 04:41

    <receiver> tag and <services> tag should be in <application> tag.

    Or if you support pre-4.4, REGISTRATION action should be added. https://developers.google.com/cloud-messaging/android/client

    If you want to support pre-4.4 KitKat devices, add the following action to the intent filter declaration for the receiver:

    0 讨论(0)
  • 2020-12-12 04:50

    You have miss some user permisssion & reciver set like this way.

    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    

    this permission to set

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

    this user permission

    <uses-permission android:name="your package.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    

    this code set in application side.

     <!-- GCM Receiver -->
       <!-- this package name set your broadcast receiver class -->
        <receiver
    
            android:name="package 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" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    
                <category android:name="main package name" />
            </intent-filter>
        </receiver>
    

    try this code in your manifest file. Thanks.

    0 讨论(0)
提交回复
热议问题