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

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

问题描述

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

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





下面是我已经添加到我的清单文件fcm工作的代码 -

 < 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>


解决方案

我搜索了很多,却找不到满意的回答。所以,我申请了这个修复程序。

我继续使用我用来发送推送通知给GCM用户和通过FCM注册的用户的旧方法,我能够通过FCM或Firebase通知控制台发送推送通知。

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

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 is working fine I'm able to receive push notifications on my device through fcm but I'm not able to send push notifications to old GCM registration tokens from FCM console.


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.

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.

P.S. You can't send push notification to GCM registration tokens through FCM.

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

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