单击时解析推送通知异常

时间:2015-10-28 13:57:53

标签: android exception android-studio parse-platform

推送通知效果很好,当我发送推送通知到达设备时。 当我点击它时会引发异常。

这是我的清单引用解析

  <service android:name="com.parse.PushService" />
    <receiver
        android:name="org.cade.codigos.ui.activities.Receiver"
        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="org.cade.codigos" />
        </intent-filter>
    </receiver>

我延长了收听者课程,就像我在一些帖子中读到但仍然引发异常

public class Receiver extends ParsePushBroadcastReceiver {

@Override
public void onPushOpen(Context context, Intent intent) {
    Log.e("Push", "Clicked");
    Intent i = new Intent(context, MainActivity.class);
    i.putExtras(intent.getExtras());
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
}

}

    10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime: FATAL EXCEPTION: main
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime: Process: org.cade.codigos, PID: 8074
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.cade.codigos/org.cade.codigos.ui.activities.MainActivity}: java.lang.IllegalStateException: ParsePlugins is already initialized
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:151)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5257)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:  Caused by: java.lang.IllegalStateException: ParsePlugins is already initialized
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.parse.ParsePlugins.set(ParsePlugins.java:39)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.parse.ParsePlugins$Android.initialize(ParsePlugins.java:153)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.parse.Parse.initialize(Parse.java:191)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at org.cade.codigos.ui.activities.MainActivity.onCreate(MainActivity.java:234)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5990)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:151) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5257) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
10-28 12:50:27.178 8074-8074/org.cade.codigos E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
10-28 12:50:28.923 8074-8074/? I/Process: Sending signal. PID: 8074 SIG: 9

0 个答案:

没有答案