2014-10-02 38 views
2

我更新解析SDK 1.7版本,並具有下列崩潰,而使用方法ParsePush.subscribeInBackground()IllegalStateException異常使用新的解析1.7的Android API

10-02 12:56:06.426: E/AndroidRuntime(5441): java.lang.IllegalStateException: In order to use the ParsePush.subscribe or ParsePush.unsubscribe methods you must add the following to your AndroidManifest.xml: 
10-02 12:56:06.426: E/AndroidRuntime(5441): <receiver android:name="com.parse.ParsePushBroadcastReceiver" 
10-02 12:56:06.426: E/AndroidRuntime(5441): android:exported="false"> 
10-02 12:56:06.426: E/AndroidRuntime(5441): <intent-filter> 
10-02 12:56:06.426: E/AndroidRuntime(5441):  <action android:name="com.parse.push.intent.RECEIVE" /> 
10-02 12:56:06.426: E/AndroidRuntime(5441):  <action android:name="com.parse.push.intent.OPEN" /> 
10-02 12:56:06.426: E/AndroidRuntime(5441):  <action android:name="com.parse.push.intent.DELETE" /> 
10-02 12:56:06.426: E/AndroidRuntime(5441): </intent-filter> 
10-02 12:56:06.426: E/AndroidRuntime(5441): </receiver> 
10-02 12:56:06.426: E/AndroidRuntime(5441): (Replace "com.parse.ParsePushBroadcastReceiver" with your own implementation if you choose to extend ParsePushBroadcastReceiver) 
10-02 12:56:06.426: E/AndroidRuntime(5441):  at com.parse.ParsePush.checkForManifestAndThrowExceptionIfNeeded(ParsePush.java:135) 
10-02 12:56:06.426: E/AndroidRuntime(5441):  at com.parse.ParsePush.subscribeAsync(ParsePush.java:65) 
10-02 12:56:06.426: E/AndroidRuntime(5441):  at com.parse.ParsePush.subscribeInBackground(ParsePush.java:79) 
10-02 12:56:06.426: E/AndroidRuntime(5441):  at com.parse.ParsePush.subscribeInBackground(ParsePush.java:88) 

儘管我上面的代碼已經複製從Parse guide的事實,都提到行在AndroidManifest.xml中。

回答

7

我剛纔注意到崩潰和片段解析指南頁面上的文本有所不同 - 它應該是

<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.ParsePushBroadcastReceiver" android:exported="false"> 
    <intent-filter> 
     <action android:name="com.push.intent.RECEIVE" /> 
     <action android:name="com.push.intent.DELETE" /> 
     <action android:name="com.push.intent.OPEN" /> 
    </intent-filter> 
</receiver> 

(注意在行動失蹤.parse名)。

+0

謝謝!花了太久才發現這一點。 – 2014-10-04 08:08:57