I have an android app successfully set up to receive notifications using Urban Airship, but am running into problems in handling the PushManager.ACTION_NOTIFICATION_OPENED) broadcast. My BroadcastReceiver is working, receiving the message, and calling the following (from the example code):
Intent launch = new Intent(Intent.ACTION_MAIN);
launch.setClass(UAirship.shared().getApplicationContext(), Main.class);
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
UAirship.shared().getApplicationContext().startActivity(launch);
This works fine and brings the main activity back to the foreground, except for the case in which the app is no longer running. If I send a notification to a phone, kill the app, and then open the notification, the app crashes on a NullPointerException:
Failed to load meta-data, NullPointer: null
Unable to takeOff automatically
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start receiver com.urbanairship.CoreReceiver: java.lang.NullPointerException
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2236)
at android.app.ActivityThread.access$1500(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
I can't figure out what could be causing this. Any thoughts?