【问题标题】:Android FCM Error FirebaseInstanceId: Error while delivering the message: ServiceIntent not foundAndroid FCM 错误 FirebaseInstanceId:传递消息时出错:找不到 ServiceIntent
【发布时间】:2019-04-03 05:44:01
【问题描述】:

FCM 通知在应用打开时工作,但当我关闭应用并将其从最近的应用中删除时,通知工作 30 秒或 1 分钟后,当我发送通知时它不工作并在 logcat 中显示错误

FirebaseInstanceId: Error while delivering the message: ServiceIntent not found. 

【问题讨论】:

  • 您是在谈论来自设备的上游消息还是来自服务器/其他来源的下游消息?
  • 下行消息
  • 这是否意味着设备上的onMessageReceived 仍然被调用,但不知何故它仍然不起作用?我不太清楚具体是什么情况。
  • 不,onMessageReceived 在未调用的设备上
  • 那么这个错误是来自发送方,还是应用程序在收到消息时仍然响应但只是响应这个错误消息?如果是后者,我怀疑您发送的消息有问题。你是发送数据消息还是普通消息?

标签: android firebase notifications firebase-cloud-messaging


【解决方案1】:

首先,确保您已将依赖项添加到 firebase 消息传递和 正如doc 建议的那样,您的接收器正确:

在app模块的build.gradle中:

implementation 'com.google.firebase:firebase-messaging:the-version

在 AndroidManifest.xml 中:

<service
    android:name=".java.MyFirebaseMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

如果你使用GCM,还提到here,你需要为你的gcm监听器设置高优先级:

<service
    android:name=".GCM.PushNotificationService"
    android:exported="false">
    <intent-filter android:priority="10000">
        <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
    </intent-filter>
</service>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多