Firebase:我可以检测服务器API密钥是FCM还是GCM? [英] Firebase: Can I detect if a Server API key is FCM or GCM?

查看:113
本文介绍了Firebase:我可以检测服务器API密钥是FCM还是GCM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我混合使用了GCM和FCM Server API密钥,它们属于不同的Android应用程序.但是,我不是应用程序的所有者,也没有直接访问google developer控制台的权限.

I have a mix of GCM and FCM Server API keys that belong to different android apps. However I am not the owner of the apps and do not have direct access to the google developer console.

是否可以检测Firebase是否启用了Cloud Messaging Server API密钥?

Is there a way to detect whether a Cloud Messaging Server API key is enabled for Firebase?

我想知道这一点,以便可以通知GCM服务器密钥的所有者更新到Firebase.

I would like to know this so that I can notify the owners of the GCM server keys to update to Firebase.

谢谢 -大卫

推荐答案

无法确定请求中使用的服务器密钥是否来自启用了GCM/FCM的项目.有 RemoteMessage.getFrom() ,它给出了发件人的发件人ID或标识了邮件发送到的主题,但没有提供任何其他详细信息.

There is no way to tell if a Server Key used in the request is from a GCM/FCM enabled project. There is RemoteMessage.getFrom() which gives the Sender ID of the sender or to identify which topic the message was sent to, but it doesn't give any other details.

与此同时,我非常确定,您什至没有办法检索发件人最初使用的服务器密钥的值.

While on the matter, I'm fairly sure that there is even no way for you to retrieve the value of the Server Key that was used by the Sender in the first place.

话虽如此,只要它是有效的服务器密钥,它就应该与GCM和FCM兼容.根据我的经验,我最初是从开发人员控制台生成的服务器密钥,然后将项目导入Firebase后, Cloud Messaging 标签中显示的服务器密钥仍然相同(不过,我不确定是否仍然如此.

With all that said, so long as it is a valid Server Key, it should be compatible to use for both GCM and FCM. From what I've experienced, I had a Server Key originally generated from my Developer Console, and after I imported the project to Firebase, the Server Key that appeared in the Cloud Messaging tab was still the same (I'm not so sure if that's still the case though).

尽管如此,用于GCM的服务器密钥仍应与FCM兼容.

Nonetheless, Server Key used for GCM should still be compatible for FCM.

这篇关于Firebase:我可以检测服务器API密钥是FCM还是GCM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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