【问题标题】:Parse - Installation table not setting deviceToken nor pushTypeParse - 安装表未设置 deviceToken 或 pushType
【发布时间】:2015-02-14 23:56:42
【问题描述】:
我有一个在 Parse 上运行的应用程序,通知运行良好。我更改了应用程序包装,并在 Parse 上创建了一个新应用程序。
对于新应用程序,_Installation 表上的 deviceToken 和 pushType 列始终为空,因此即使从 Parse 网页发送推送也不起作用,并且在启动应用程序时会生成一个新条目。
我已经更新了我的 java 代码和我的云代码上的解析键。
有人知道我可能错过了什么或可能发生什么,因此相同的代码在具有相同配置的不同应用中具有不同的行为?
如果我使用 pushType="gcm" 和 "deviceToken" 更新其中一个安装,我在另一个应用中拥有的那个,此设备会收到通知。
谢谢
【问题讨论】:
标签:
parse-platform
push-notification
google-cloud-messaging
devicetoken
【解决方案1】:
好的,我遇到了类似的问题。这两列都是空的。
这主要是由于清单问题。
您的权限似乎没问题,因为您正在收到通知并且还能够在解析数据库中注册。
所以问题应该出在<receiver> 标签中,应该只有 2 个像我这样。
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: If you change the package name of this sample app,
change "com.parse.tutorials.pushnotifications" in the lines
below to match the new package name.
-->
<category android:name="com.example.ifis" />
</intent-filter>
</receiver>
如果您有像“com.google.android.gcm.GCMBroadcastReceiver”这样的接收器,请移除一个<service android:name="com.parse.PushService" />
【解决方案2】:
启用解析日志记录:
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
就我而言,我缺少 GCM 权限
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="my.package.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="my.package.permission.C2D_MESSAGE" />