Register Push Token Error

Hello, I’ve just updated my Android app with SendBird SDK upgraded from v3.0.139 to v3.0.155. After this update, I’m seeing a decent number of failures of push token registration with call SendBird.registerPushTokenForCurrentUser. Is there an issue with SDK version or did I miss some migration steps. Btw, I couldn’t find any relevant thing in release notes.
Looking forward to the solution.
Cheers.

Hi @Asem, thank you for reporting this problem to us. We will take a look at this issue and get back to you! Having the error logs & code snippets you used would help us troubleshoot the issue - could you please provide them? (it is not mandatory though) Thank you.

I’m using this code snippet:

SendBird.registerPushTokenForCurrentUser(token) { tokenRegStatus, e ->
    if (e != null)  Logger.log(e)
    handleChatPushTokenStatus(tokenRegStatus)
}

Here, tokenRegStatus is null which is causing crash due to my handling. In earlier version, this never happened.
Unfortunately, I don’t have the sufficient logs in place to know the error code. There are some logs though for the exception but our obfuscation is playing dirty here.

c.a.b.y.d.d(SourceFile:4) at c.a.b.y.d.e(SourceFile:1) at c.a.b.d0.i.onError(SourceFile:3) at m.b.h0.e.f.j$a.run(SourceFile:2) at m.b.x$a.run(SourceFile:2) at m.b.h0.g.l.run(SourceFile:2) at m.b.h0.g.l.call(SourceFile:1) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) Caused by: c.a.b.t.e.a: timeout at c.a.b.t.c.b.a$n$a.a(SourceFile:3) at c.w.a.s2.a(SourceFile:3) at c.w.a.z1$a$a.run(SourceFile:1) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

Also, we never faced this issue while on v3.0.139

Hey @Cjeon

Is there anything else that I can provide which may be helpful in debugging this issue?

Hi @Asem, thank you for the kind response, the logs, and the code snippet. From the error log, we can tell that there was some timeout error, but unfortunately no further. If it is possible, could you please try to de-obfuscate your error logs using your proguard mapping file? If it helps, here are some links that I found helpful:

Also, I found from your code snippet that your code is not returning when there is an error. That is, in

SendBird.registerPushTokenForCurrentUser(token) { tokenRegStatus, e ->
    if (e != null)  Logger.log(e)
    handleChatPushTokenStatus(tokenRegStatus)
}

does the error rate decrease if we change it to below?

SendBird.registerPushTokenForCurrentUser(token) { tokenRegStatus, e ->
    if (e != null)  {
         Logger.log(e)
         return
    }
    handleChatPushTokenStatus(tokenRegStatus)
}

If it does, knowing the error message could help us debug the issue.

I’m sorry that our SDK is causing you trouble. We will try our best to find the solution for you as soon as possible. Thank you for your understanding. :pray:

Thanks @Cjeon for the detailed response. Yeah, the cods snippet I shared is a subset of what I’m using. I tried to share only the relevant part. I’ll try to deobfuscate the stacktrace.
But, the thing here is that tokenRegStatus was always non-null in our earlier SDK, v3.0.139, implementation. Has it been changed after v139, to make tokenRegStatus null in case of error? I didn’t find any such update in release notes though.

@Asem Oh… I think I may have found the relevant change. During our refactoring process, I think our code changed to return null in case of an error - such as when the token is null. Is your token a String? type? Then if the token is null, the tokenRegStatus could be null. I’ll test this and get back to you. If this was the case, we will release a fix for this shortly.

Meanwhile, if the error is non-null, it is highly likely that the token will be null. Please check-and-return for a workaround before our release for this :bowing_man:‍♂. Sorry that I found this too late.

@Cjeon thanks for getting back with the update.

I’ve verified from code that token is String type and not null check is already in place. So, it seems like this is not the case here. But, token registration might have have failed due to some other reason. In that case, the null tokenRegStatus, which was non-null earlier, is causing the problem here. Anyhow, I’ve updated the handling to better cater for the error case.

@Asem, I just submitted a fix for this issue, and if it is not delayed for other reasons, it will be shipped on the next regular release, which is scheduled to be next Tuesday. I’ll update here once the release is done. Thank you for the bug report && detailed follow-up :+1:.

@Cjeon thanks for the support. I’m looking forward to the release :slight_smile:

Hi @Asem, the regular release was delayed a little bit and it was released yesterday! Please check and let me know if anything is not working as expected. Thank you and please have a good day :+1:

1 Like