【发布时间】:2016-04-19 14:34:56
【问题描述】:
在我的 GcmListenerService 中,我得到了这个捆绑数据:
Bundle[{gcm.notification.e=1, gcm.notification.title=SomeApp, proceed=true, gcm.notification.body=Some text, message=Some message, collapse_key=example.com.SomeApp}]
我可以通过
得到消息bundle.getString("message");
但我无法在捆绑数据中获取 proceed 布尔值。 我用过:
bundle.getBoolean("proceed",false);
即使捆绑数据中的值为 true,这始终给出 false。 这很简单,我不知道我错过了什么。 谢谢。
【问题讨论】:
-
您是否尝试过使用
bundle.getString("proceed");来查看是否存储为String? -
不,我使用 getBoolean 因为它有一个默认值。我想我将不得不检查 getString 并检查空值。谢谢你的建议。
-
它是不小心发送的。
标签: android google-cloud-messaging android-bundle gcmlistenerservice