在 android 上从 gcm 迁移到 fcm [英] Migrating from gcm to fcm on android

查看:25
本文介绍了在 android 上从 gcm 迁移到 fcm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android 应用中从 gcm 迁移到 fcm.我是否需要从 gcm 向 android 应用程序的老用户发送推送通知,或者我可以通过服务器的新 fcm 发送它?

I want to migrate from gcm to fcm in android app. Do I need to send push notification to old users of the android app from gcm or i can send it through the new fcm from server?

FCM 工作正常我能够通过 fcm 在我的设备上接收推送通知,但我无法从 FCM 控制台向旧 GCM 注册令牌发送推送通知.


下面是我添加到我的清单文件中的代码,以便 fcm 工作-


Below is the code I've added to my manifest file for fcm to work-

<uses-permission android:name="com.google.android.z.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application>
    <service
        android:name=".view.activity.MyFcmListenerService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

    <service
        android:name=".view.activity.MyInstanceIDListenerService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
</application>

推荐答案

我搜索了很多,但没有找到满意的答案.所以,我应用了这个修复.

I searched a lot but couldn't find a satisfactory answer. So, I applied this fix.

我继续使用旧方法向 GCM 用户发送推送通知,对于通过 FCM 注册的用户,我可以通过 FCM 或 Firebase 通知控制台向他们发送推送通知.

I am continuing using the old method I was using to send push notifications to GCM users and for the users who registers through FCM, I am able to send them push notifications through FCM or Firebase Notification console.

附注您无法通过 FCM 向 GCM 注册令牌发送推送通知.

这篇关于在 android 上从 gcm 迁移到 fcm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆