为什么Android解析安装中缺少pushType?

时间:2016-11-05 23:57:22

标签: android google-cloud-messaging parse-server

我正在尝试使用GCM和Parse Server在Android上设置推送通知。我将密钥添加到server.js,因此我可以从仪表板发送通知,但Android没有收到任何通知。我可以使用ParseInstallation.getCurrentInstallation().saveInBackground();将设备添加到Installation表中,但GCMSenderId,deviceToken和pushType都是未定义的。

经过一番搜索后,我想可能是我的清单出了问题。我添加了这些权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
    android:name="com.parse.permission.C2D_MESSAGE" />
<uses-permission android:name="com.parse.permission.C2D_MESSAGE" />

然后,在<application>内,我添加了<meta-data android:name="com.pickmeup.push.gcm_sender_id" android:value="id:NUMBER_FROM_GOOGLE_DEVELOPER_CONSOLE" />。然后,在我关闭<application>之前,我添加了:

<service android:name="com.parse.PushService" />
<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" />

        <category android:name="com.myAppPackage" />
    </intent-filter>
</receiver>

<meta-data android:name="com.parse.push.gcm_sender_id"
        android:value="id:NUMBER_FROM_GOOGLE_DEVELOPER_CONSOLE" />

我错过了什么吗?

0 个答案:

没有答案