gpt4 book ai didi

安卓通知 : onMessageReceived not called

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:51:59 25 4
gpt4 key购买 nike

首先,这不是因为应用程序在后台。

通知与数据消息负载一起发送。在 Play 控制台中,它表示消息已“已确认”,因此它们正在到达设备。对于大多数用户,onMessageReceived 方法被调用,但对于少数用户,它不是。为什么会这样?

安卓 list :

<service android:name=".push.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".push.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>

MyFirebaseMessagingService:

public class MyFirebaseMessagingService extends FirebaseMessagingService {

...
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
...
}

最佳答案

发生这种情况的主要原因之一是特定用户更改了他的登录详细信息或在使用该应用程序时使用了不同的帐户。在这种特殊情况下,特定设备 token 会收到通知,但由于他使用的是不同的帐户,因此不会显示通知。解决此问题的一种方法是在每次用户注销时清除用户的设备 token ,并在用户再次登录时保存新创建的设备 token 。这样设备 token 就会保持更新,用户将收到通知。

关于安卓通知 : onMessageReceived not called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47159376/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com