谷歌云沙盒留言 [英] Google Cloud Message Sandbox

查看:202
本文介绍了谷歌云沙盒留言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟着教程来实现我的Andr​​oid应用程序的推送通知(谷歌云留言)。我设法成功地实施这些消息,但现在我很担心开发/生产环境。世界上只有一个(谁拥有沙箱键和生产的重点在苹果对面)API密钥。怎么你们这个处理?我不希望我的GCM测试发射实消息给用户。

I followed the tutorial to implement push notifications on my Android App (Google Cloud Message). I managed to successfully implement these messages but now I'm concerned about dev/production environment. There is only one API key (in opposite of Apple who has sandbox key and production key). How you guys deal with this? I don't want my gcm tests firing real messages to users.

推荐答案

您可以使用 dry_run 字段:

dry_run

如果包括,允许开发人员无需实际测试他们的要求
  发送消息。可选。默认值是假的,而且必须是
  JSON布尔值。

If included, allows developers to test their request without actually sending a message. Optional. The default value is false, and must be a JSON boolean.

如果它不工作,你可以尝试用一个无效的包名称 restricted_pa​​ckage_name 字段。我还没有尝试过,但它可能会表现得你想要的方式。

If it doesn't work you can try the restricted_package_name field with an invalid package name. I haven't tried it, but it might behave the way you want.

restricted_pa​​ckage_name

restricted_package_name

一个包含应用程序的包名字符串。当设置,
  消息将只发送匹配包注册ID
  名称。可选。

A string containing the package name of your application. When set, messages will only be sent to registration IDs that match the package name. Optional.

引号是从 GCM建筑概述服用。

这篇关于谷歌云沙盒留言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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