2014-10-02 41 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