Google 云消息教程 - 消息不发送
Google Cloud Messaging tutorial - messages don't send
我正在关注 Google Cloud messaging tutorial,我不是很了解短语:
First, make sure your Server key (not the client API key in googleservices.json) is provided as the value of API_KEY in GcmSender.java.
那么为了运行这个示例,我需要写一个服务器端吗?我认为 GcmSender.java 已经模拟了应用程序的服务器端?有人可以澄清一下吗?
作为@MohanadMohie,您应该改用 FCM。
First, make sure your Server key (not the client API key in googleservices.json) is provided as the value of API_KEY in GcmSender.java
GcmSender.java确实模拟了发送消息的功能。这仅说明您应该确保您使用的 API 密钥是有效的服务器密钥。
根据服务器密钥,GCM docs 中已经有一条注释说:
Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
另外,在 FCM 中,您将能够使用 Firebase 控制台发送推送通知。
我正在关注 Google Cloud messaging tutorial,我不是很了解短语:
First, make sure your Server key (not the client API key in googleservices.json) is provided as the value of API_KEY in GcmSender.java.
那么为了运行这个示例,我需要写一个服务器端吗?我认为 GcmSender.java 已经模拟了应用程序的服务器端?有人可以澄清一下吗?
作为@MohanadMohie,您应该改用 FCM。
First, make sure your Server key (not the client API key in googleservices.json) is provided as the value of API_KEY in GcmSender.java
GcmSender.java确实模拟了发送消息的功能。这仅说明您应该确保您使用的 API 密钥是有效的服务器密钥。
根据服务器密钥,GCM docs 中已经有一条注释说:
Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
另外,在 FCM 中,您将能够使用 Firebase 控制台发送推送通知。