Android Parse推送通知不起作用 - "过时的设备"

时间:2015-10-12 15:15:10

标签: java android parse-platform notifications push

完成本教程后: https://parse.com/apps/quickstart#parse_push/android/native/existing

这一个: http://www.androidhive.info/2015/06/android-push-notifications-using-parse-com/

并阅读有关stackoverflow的所有相关问题,我仍然无法弄清楚为什么Parse告诉我设备已经过时了。

这里是清单:

<form action ="update.php" method="GET">
     <input type ="hidden" name="ID"<?php echo"value=".$_REQUEST["studentid"];?>>
     <input type ="text" name="fname"<?php echo"value=".$_REQUEST['fname'];?>>
    <input type ="text"name="lname"<?php echo"value=".$_REQUEST['lname'];?>>.
     <input type ="submit"value="Update">
</form>

...

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.GET_TASKS"/>

<permission android:protectionLevel="signature"
    android:name="com.myPackage.myApp.C2D_MESSAGE" />
<uses-permission android:name="com.myPackage.myApp.C2D_MESSAGE" />

应用程序看起来像这样:

<service android:name="com.parse.PushService"/>
    <receiver android:name=".Receiver.CustomPushReceiver"
        android:exported="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="com.parse.push.intent.RECEIVE" />
            <action android:name="com.parse.push.intent.DELETE" />
            <action android:name="com.parse.push.intent.OPEN" />
        </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.myPackage.myApp"/>
        </intent-filter>
    </receiver>
    <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
        <intent-filter>
            <action android:name="com.parse.push.intent.RECEIVE"/>
            <action android:name="com.parse.push.intent.DELETE"/>
            <action android:name="com.parse.push.intent.OPEN"/>
        </intent-filter>
    </receiver>
    <meta-data android:name="com.parse.push.gcm_sender_id"
        android:value="id:myAppAndroidUser" />

我使用Lollipop和Parse 1.9.3

我甚至看到了日志声明&#34;订阅了ParsePush,&#34;所以我必须亲近......

1 个答案:

答案 0 :(得分:0)

好吧,我想我终于搞清楚了,因为我收到通知从Parse成功通过(最后!) 我用这个替换了自定义接收器(这是其中一个教程的一部分):

<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>

不完全确定为什么会有效,但我认为这就是它的作用。