pusher / push-notifications-android

Android SDK for Pusher Beams
https://www.pusher.com/beams
MIT License
21 stars 22 forks source link

setUserId random failures #82

Closed mea-licensing closed 4 years ago

mea-licensing commented 5 years ago

When using the authenticated users login flow I get random failures in the setUserId call.

Process:

At this point, the setUserId calls back to onFailure inconsistently. This only happens sometimes, other times setUserId calls back to onSuccess and everything works fine.

Stack trace:

    com.pusher.pushnotifications.api.PushNotificationsAPIBadRequest: A request to the server has been deemed invalid
        at com.pusher.pushnotifications.api.PushNotificationsAPI$setUserId$1.invoke(PushNotificationsAPI.kt:301)
        at com.pusher.pushnotifications.api.PushNotificationsAPI$setUserId$1.invoke(PushNotificationsAPI.kt:77)
        at com.pusher.pushnotifications.api.RetryStrategy$WithInfiniteExpBackOff.retry(PushNotificationsAPI.kt:45)
        at com.pusher.pushnotifications.api.PushNotificationsAPI.setUserId(PushNotificationsAPI.kt:294)
        at com.pusher.pushnotifications.internal.ServerSyncProcessHandler.processSetUserIdJob(ServerSyncHandler.kt:391)
        at com.pusher.pushnotifications.internal.ServerSyncProcessHandler.processJob(ServerSyncHandler.kt:454)
        at com.pusher.pushnotifications.internal.ServerSyncProcessHandler.handleMessage(ServerSyncHandler.kt:495)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)

How can I ensure my users id's are always set correctly?

mea-licensing commented 4 years ago

This is fixed in 1.6.0 with a new message

com.pusher.pushnotifications.api.PushNotificationsAPIUnprocessableEntity: The request was deemed to be unprocessable: Unprocessable Entity: User has reached the maximum of 10 devices