ibm-bluemix-mobile-services / bms-clientsdk-android-push

Android Push notifications SDK for IBM Cloud Mobile Services
Apache License 2.0
10 stars 12 forks source link

MFPPush NullPointerException #77

Closed SebastianSingle99 closed 7 years ago

SebastianSingle99 commented 7 years ago

Sometimes I'm getting this with version 3.6.2

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference at com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush$6.onFailure(MFPPush.java:737) at com.ibm.mobilefirstplatform.clientsdk.android.push.internal.MFPPushInvoker.onFailure(MFPPushInvoker.java:103) at com.ibm.mobilefirstplatform.clientsdk.android.core.api.Request$1.onFailure(Request.java:185) at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:185) at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:776)

Seems that the response object can be null and the logging statement at line 737 crashes the app.

AnanthaKrish commented 7 years ago

@SebastianSingle99 is this happening after getting notification ?

SebastianSingle99 commented 7 years ago

I could not reproduce this by myself. During testing everything worked, but customers are getting this issue very often in the released app.

AnanthaKrish commented 7 years ago

@SebastianSingle99 I will look into this issue and get back to you ...

AnanthaKrish commented 7 years ago

@SebastianSingle99 this problem will not occur in the new version 3.6.3.. Please let me know if you face any issue .. Thanks

edskeizer commented 6 years ago

Still facing this issue with 3.6.3 as well. I have installed the Cordova plugin for Android from Github

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
    at com.ibm.mobilefirstplatform.clientsdk.android.push.internal.MFPPushUtils.getIntentPrefix(MFPPushUtils.java:34)
    at com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush.listen(MFPPush.java:303)
    at com.ibm.mobilefirstplatform.clientsdk.cordovaplugins.push.CDVBMSPush$10.run(CDVBMSPush.java:367)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

It appears when starting the app, not when receiving a notification.

AnanthaKrish commented 6 years ago

@edskeizer which version of android OS you are using ?

edskeizer commented 6 years ago

@AnanthaKrish this happened on Android 6.0 (according to the crashlog in the Play Store). I do not have it myself. I followed all the steps of the plugin installation guide...

AnanthaKrish commented 6 years ago

@edskeizer

  1. is it failing always ?
  2. are you trying to call BMSPush.registerNotificationsCallback() before calling BMSPush.initialize() .