Firebase cloud messaging notification not received by device

前端 未结 20 1899
栀梦
栀梦 2020-11-28 23:58

I am having an issue with FireBase Cloud Messaging in which I get the Token from the device and send the notification test through the Google Firebase notification console h

相关标签:
20条回答
  • 2020-11-29 00:59
        <activity android:name=".activity.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- Firebase Notifications -->
        <service android:name=".service.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
    
        <service android:name=".service.MyFirebaseInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
    
    0 讨论(0)
  • 2020-11-29 01:01

    You need to Follow Below Manifest Code (must have Service in manifest)

     <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="soapusingretrofitvolley.firebase">
            <uses-permission android:name="android.permission.INTERNET"/>
            <application
                android:allowBackup="true"
                android:icon="@mipmap/ic_launcher"
                android:label="@string/app_name"
                android:supportsRtl="true"
                android:theme="@style/AppTheme">
                <activity android:name=".MainActivity">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
    
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
    
                <service
                    android:name=".MyFirebaseMessagingService">
                    <intent-filter>
                        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
                    </intent-filter>
                </service>
    
                <service
                    android:name=".MyFirebaseInstanceIDService">
                    <intent-filter>
                        <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
                    </intent-filter>
                </service>
            </application>
    
        </manifest>
    
    0 讨论(0)
提交回复
热议问题