ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

Issue in CDVBMSPush.java :- bms-push plugin

Closed this issue · 4 comments

I'm using bms-push plugin for my cordova project. We have noticed that , in "CDVBMSPush.java" file, there is
onResume method which invokes MFPPush.getInstance().listen(notificationListener).

Inside onResume method, we couldn't find any null check for "notificationListener" before invoking the below line:-
MFPPush.getInstance().listen(notificationListener) .

Only inside “registerNotificationsCallback" method , notificationListener is defined.

There was a scenario where our app goes to background soon after initialize (ie BMSPush.initialize method) and before invoking "registerNotificationsCallback" . We were not getting notifications in our app until we go to background mode again.

So kindly requesting you to include the null check for "notificationListener" in onResume method before invoking
MFPPush.getInstance().listen(notificationListener).

@AnanthaKrish Any update with this issue? I also counter this issue. So, sometimes my app crash after launch. I cannot continue my development if the error is not solved.

@almasmaris HI, the above one is a requirement .. Any logs on why your app is failing ?

c06-05 15:26:47.970 32557-32672/id.code.jasindo E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-4 Process: id.code.jasindo, PID: 32557 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:304) at com.ibm.mobilefirstplatform.clientsdk.cordovaplugins.push.CDVBMSPush$10.run(CDVBMSPush.java:369) 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)

here it is. It's error when invoking MFPPush.getInstance().listen(notificationListener);

@almasmaris I have added a null checker in onResume(). Please use latest plugin 3.3.1