Hello,
whenever I receive a push notification I get the following exception where messageId is a value I can’t modify! The same code used to work on my 3.x version…
"
W/Bundle: Key com.backendless.messageid expected Integer but value was a java.lang.String. The default value 0 was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at android.os.BaseBundle.getInt(BaseBundle.java:967)
at android.content.Intent.getIntExtra(Intent.java:7641)
at com.backendless.push.BackendlessPushService.handleMessage(BackendlessPushService.java:150)
at com.backendless.push.BackendlessPushService.handleIntent(BackendlessPushService.java:128)
at com.backendless.push.BackendlessPushService.onHandleWork(BackendlessPushService.java:97)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
I/PushIntent: action: com.google.android.c2dm.intent.RECEIVE data: null extras: android-ticker-text=llc_admin_message com.backendless.messageid=message:4F1BCAA4-2C8B-4273-8B48-48154047F7D0 google.sent_time=1534882782680 google.ttl=2419200 android-content-text=Hry from=32461687890 google.message_id=0:1534882782691231%3940a697f9fd7ecd google.priority=normal message=Jwjwm BL_APPLICATION_ID=709E3602-AABE-41E9-FF47-48B4C07F4700
I/MessageListPrefs: [Hry : Jwjwm, Test : Vhhbv, Yo : Yo]
W/Bundle: Key com.backendless.messageid expected Integer but value was a java.lang.String. The default value 0 was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at android.os.BaseBundle.getInt(BaseBundle.java:967)
at android.content.Intent.getIntExtra(Intent.java:7641)
at com.backendless.push.BackendlessPushService.handleMessage(BackendlessPushService.java:242)
at com.backendless.push.BackendlessPushService.handleIntent(BackendlessPushService.java:128)
at com.backendless.push.BackendlessPushService.onHandleWork(BackendlessPushService.java:97)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:391)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
"
Done, the exception disappeard but I still can’t see any notifications in the panel even though the push is well processed.
Here is the log I am getting:
D/InputEventReceiver: channel ‘b231eb8 fr.livelovecite/fr.livelovecite.push.PushActivity (client)’ ~ Disposing input event receiver.
channel ‘b231eb8 fr.livelovecite/fr.livelovecite.push.PushActivity (client)’ ~NativeInputEventReceiver.
Yes, this is not an error but this is what I am getting now.
I do not receive the notification in my Notification Panel (in the tray that I slide from up to down) but in the logs of Android studio I see that it was saved in my Prefs and added to my apps notification list.
sorry for coming back to this case but I am still unable to find the reason why push notifications do not appear in my notification panel.
I do not have any stack traces in my IDE when I receive notifications but gladly, I found the crash report thanks to the Play Console. Here is what I get:
java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3399)
at android.app.ActivityThread.-wrap18 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1780)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6944)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException:
at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1538)
at android.app.ContextImpl.startService (ContextImpl.java:1484)
at android.content.ContextWrapper.startService (ContextWrapper.java:663)
at android.content.ContextWrapper.startService (ContextWrapper.java:663) at com.backendless.push.BackendlessBroadcastReceiver.startWakefulService (BackendlessBroadcastReceiver.java:143)
** at com.backendless.push.BackendlessBroadcastReceiver.onReceive (BackendlessBroadcastReceiver.java:94)**
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3392)
Knowing that I haven’t changed anything within my code after the migration and since this crash is occuring on most of the phones that have an older enrolled version of my app… I do believe that there must be something in the API.
We still can’t reproduce the problem on our environment. We’ve assigned a task to our engineer to look into your case. Task id for referencing purposes: BKNDLSS-17500. Sorry for inconvenience
What version of backenless android-sdk do you use? It seems that the version you use is too old.
Could you please try a new one from maven repository for example.