Key com.backendless.messageid receiving String instead of INT

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)
"

Please help! Thank you in advance.

Ralph

Hi Raplh,

Do you use the latest version of the SDK? I am trying to match the line numbers to the latest code and it doesn’t match( there is no call to getIntExtra in BackendlessPushService: https://github.com/Backendless/Android-SDK/blob/master/src/com/backendless/push/BackendlessPushService.java )

Regards,
Mark

Hi Mark,
Thank you for your quick response!

I am compiling the backendless 5.0.2 within my gradle… Is there anything else that I am missing?

implementation ‘com.backendless:backendless:5.0. 2’

Hi Ralph,

Thanks, I am looking into it. The code in the master branch is not what made to 5.0.2, that’s why there is a discrepancy.

Could you please let me know if you publish through console or using the API?

Regards,
Mark

Hi Mark,
I am publishing through the API from my Android app.
Would you need a code snippet or anything?

Thank you for the help again!

Hi Ralph,

we have found the issue, we will fix and release it as soon as it possible.

1 Like

Hi Ralph

We’ve released some changes that solve the issue you’ve described. Please let us know whether everything is ok now on your side

Anton

Hi Sergey and Anton,
that’s great to hear!

Is there anything I should do from my side other than compiling ?
implementation group: ‘com.backendless’, name: ‘backendless’, version: ‘5.0.2’

Regards

No, simply repeat the scenario which was causing the issue

Anton

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.

That’s not an error

What do you mean by ‘panel’? Do you receive any push notifications on device?

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.

I will look closer in this and let you know

Hello again,

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.

Help please…

Thanks!

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

Anton

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.

Hello Oleg,
I am using the latest one: 5.0.2
implementation ‘com.backendless:backendless:5.0. 2’

build.txt (1.7 KB)

Hi Ralph,

Could you please check if backendless.jar is perhaps present in the “libs” directory? There is an instruction to include all jars from there.

Regards,
Mark

You may also need to invalidate your project’s cache, if you’d previously been working with an older version of Backendless library

Anton

I would also recommend to clear local cache of maven and/or gradle (the folder where backendless.jar resides).

Hello Mark,
it is not included in the “libs”. I have just checked.

Regards.