Android 2上的Parse Push崩溃

时间:2015-02-13 10:08:07

标签: android parse-platform push-notification

我已经使用Parse向我的应用添加了推送通知支持。它在大多数Android版本上运行良好,但在Android 2.2上我遇到了以下崩溃 - 我实际上甚至没有发送任何推送通知,所以这必须在应用程序的正常运行中发生:

java.lang.RuntimeException: Unable to start receiver com.parse.ParsePushBroadcastReceiver: java.lang.NullPointerException
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:1871)
       at android.app.ActivityThread.access$2400(ActivityThread.java:118)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:998)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:130)
       at android.app.ActivityThread.main(ActivityThread.java:3756)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:507)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.NullPointerException
       at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:112)
       at org.json.JSONTokener.nextValue(JSONTokener.java:90)
.....

我见过关于NullPointerException的其他帖子,但他们总是因为清单中缺少通知图标。

我不知道是不是因为我还有自己的闹钟接收器每天都会报警?

对于它的价值,这是AndroidManifest.xml中的内容:

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
...>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission android:protectionLevel="signature"
            android:name="[mypackage].permission.C2D_MESSAGE" />
    <uses-permission android:name="[mypackage].permission.C2D_MESSAGE" />

<application ...>
    <meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/notification_icon"/>

    <receiver android:name=".AlarmReceiver"/>

    <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.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>
    <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="[mypackage]" />
        </intent-filter>
    </receiver>

    </application>
</manifest>

0 个答案:

没有答案