Android - unable to launch receiver com.parse.ParsePushBroadcastReceiver

I'm trying to test a very basic push notification program using Parse, but my app crashes when I broadcast a notification. This is my error log.

    10-02 23:21:45.625: E/AndroidRuntime(6133): FATAL EXCEPTION: main
    10-02 23:21:45.625: E/AndroidRuntime(6133): java.lang.RuntimeException: Unable to start receiver com.parse.ParsePushBroadcastReceiver: java.lang.NullPointerException
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2372)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.app.ActivityThread.access$1500(ActivityThread.java:149)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.os.Handler.dispatchMessage(Handler.java:99)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.os.Looper.loop(Looper.java:153)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.app.ActivityThread.main(ActivityThread.java:4987)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at java.lang.reflect.Method.invokeNative(Native Method)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at java.lang.reflect.Method.invoke(Method.java:511)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at dalvik.system.NativeStart.main(Native Method)
    10-02 23:21:45.625: E/AndroidRuntime(6133): Caused by: java.lang.NullPointerException
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.parse.ParsePushBroadcastReceiver.getSmallIconId(ParsePushBroadcastReceiver.java:253)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:335)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:143)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at com.parse.ParsePushBroadcastReceiver.onReceive(ParsePushBroadcastReceiver.java:104)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2365)
    10-02 23:21:45.625: E/AndroidRuntime(6133):     ... 10 more

      

Can someone please tell me why ParsePushBroadcaseReceiver won't start? It can also help to find out that my application has not "subscribed to push" when I call:

ParsePush.subscribeInBackground("channel_name", new SaveCallback() {
      @Override
      public void done(ParseException e) {
        if (e != null) {
          Log.v("com.parse.push", "successfully subscribed to the broadcast channel.");
        } else {
          Log.v("com.parse.push", "failed to subscribe for push", e);
        }
      }
    });

      

+3


source to share


1 answer


Add this line to your project manifest.



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

      

+12


source







All Articles