在 android 上从 gcm 迁移到 fcm

2023-07-29移动开发问题
1

本文介绍了在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何在 COCOS2d Android 中使用 CClistview?
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)...
2024-08-12 移动开发问题
5

cocos2d-android:如何显示分数
cocos2d-android: how to display score(cocos2d-android:如何显示分数)...
2024-08-11 移动开发问题
7

Sqlite 数据库未从资产文件夹 Android 复制
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)...
2024-04-15 移动开发问题
8

SQLite 数据库副本在由设备而不是模拟器生成时出现损坏
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)...
2024-04-15 移动开发问题
4

安卓文件拷贝
Android file copy(安卓文件拷贝)...
2024-04-15 移动开发问题
6

Android如何在android中检测Edittext的Copy事件
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)...
2024-04-15 移动开发问题
5