PushManager.getInstance(this) return Null

Comments

3 comments

  • Avatar
    mong

    solve it !

    PW_PROJECT_ID – Project Number you receive from Google (Locate your Project Number) prefixed with A.

    just 'A'....

    sry

  • Avatar
    Andreas Lundgren

    I'm still having this problem. I have the A prefix in my PW_PROJECT_ID, but the cause seems to be something else. Been trying to fix this for two days now. I have no clue what is causing this. The main problem seems to be that the instance of the the PushManager is null:

    PushManager pushManager = PushManager.getInstance(this);
    

    My stack trace:

    07-06 10:49:41.018 6439-6439/com.foobar.FOOBARAPP I/Pushwoosh: Log level: NOISE
    07-06 10:49:41.028 6439-6439/com.foobar.FOOBARAPP E/Pushwoosh: [PushManager] Tried to get instance of PushManager with no Pushwoosh App ID or Project Id set
    07-06 10:49:41.028 6439-6439/com.foobar.FOOBARAPP D/AndroidRuntime: Shutting down VM
    07-06 10:49:41.028 6439-6439/com.foobar.FOOBARAPP E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: com.foobar.FOOBARAPP, PID: 6439
                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foobar.FOOBARAPP/com.foobar.FOOBARAPP.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pushwoosh.PushManager.registerForPushNotifications()' on a null object reference
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2658)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)
                                                                           at android.app.ActivityThread.access$900(ActivityThread.java:172)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:145)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5832)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
                                                                        Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pushwoosh.PushManager.registerForPushNotifications()' on a null object reference
                                                                           at com.foobar.FOOBARAPP.MainActivity.onCreate(MainActivity.java:56)
                                                                           at android.app.Activity.performCreate(Activity.java:6221)
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2611)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723) 
                                                                           at android.app.ActivityThread.access$900(ActivityThread.java:172) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:145) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5832) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    
  • Avatar
    Andreas Lundgren

    Okay, I just solved this by placing the meta-data tags correctly in the AndroidManifest.xml. See my comment here: https://community.pushwoosh.com/questions/1007/android-integration-problem

Please sign in to leave a comment.