使用新的Parse 1.7 Android API的IllegalStateException

Fen*_*res 2 android push-notification parse-platform

我正在将Parse SDK更新到1.7版,并在使用方法时发生以下崩溃ParsePush.subscribeInBackground():

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)
Run Code Online (Sandbox Code Playgroud)

尽管事实上我已经从Parse指南中复制了上面的代码,并且已经将所有提到的行放在了AndroidManifest.xml中.

Fen*_*res 7

我刚刚注意到Parse指南页面上崩溃和片段的文本不同 - 它应该是

<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>
Run Code Online (Sandbox Code Playgroud)

而不是指南说:

<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>
Run Code Online (Sandbox Code Playgroud)

(通知.parse名称中缺少通知).