Firebase: Can I detect if a Server API key is FCM or GCM?

淺唱寂寞╮ 提交于 2019-12-12 04:23:32

问题


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.

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

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

Thanks -David


回答1:


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.

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

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



来源:https://stackoverflow.com/questions/42798408/firebase-can-i-detect-if-a-server-api-key-is-fcm-or-gcm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!