Android Kotlin Pusher error Start method must be called before setUserId pusher
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 15/100
Línea de trabajo
The report is a Kotlin Android app calling PushNotifications.start, setUserId, close and clearAllState from the Beams SDK, and it crashes with 'Start method must be called before setUserId'. Start with the sequence in the snippet: start runs inside GlobalScope.launch, while setUserId runs only after an async view-model callback, and close and clearAllState run during logout. The work is done when the ordering problem is reproduced or explained and the reporter's flow is confirmed. The issue has two comments, no assignee and no linked pull request, and the last comment was about 994 days ago, so confirm with a maintainer that it is still wanted before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
version pusher = "2.2.1"
version pusherNotifications = "1.6.2"
Hi,
I don´t understand this error... It only happens when I close session and call to
PushNotifications.close()
PushNotifications.clearAllState()
Then when go to my first Activity the app crash with the error
Pusher error Start method must be called before setUserId pusher.
But as you can see in my below code I call PushNotifications.start() first.
When the apps crash and open again, all works fine
My code
onCreate(savedInstanceState: Bundle?) {initPusher() }
initPusher is this code
GlobalScope.launch(dispatchers.main) {
PushNotifications.start(applicationContext, "xxxxxxx-xxx-xxxxx-xx-xxxxxx")
viewModel.loadInfoPusherSubscribe {
val userId = it.first
val token = it.second
val realToken = "Bearer "+ token
val realURL = "https://xxxxxxxxxxx?user_id=$userId"
val tokenProvider = BeamsTokenProvider(
realURL,
object : AuthDataGetter {
override fun getAuthData(): AuthData {
return AuthData(
// Headers and URL query params your auth endpoint needs to
// request a Beams Token for a given user
headers = hashMapOf( Pair("Authorization", realToken),
Pair("accept", "text/plain"),
Pair("Content-Type", "application/json-patch+json")),
queryParams = hashMapOf()
)
}
}
)
PushNotifications.setUserId(userId, tokenProvider,
object : BeamsCallback<Void, PusherCallbackError> {
override fun onFailure(error: PusherCallbackError) {
Log.e("BeamsAuth", "Could not login to Beams: ${error.message}");
}
override fun onSuccess(vararg values: Void) {
Log.i("BeamsAuth", "Beams login success");
}
}
)
}
}
My viewModel
suspend fun loadInfoPusherSubscribe(listener: InfoPusherListener)=
viewModelScope.launch(dispatchers.io) {
val profileId = async { profileDao.getProfileUser().id }
val token = async { session.getSessionUser().accessToken }
withContext(dispatchers.main){
listener.invoke(Pair(profileId.await(),token.await()))
}
}
What is the problem?
PushNotifications.start() is asynchronous method???
- Lenguaje dominante
- Java
- Estrellas
- 315
- Forks
- 140
- Merge medio
- 11 d 5 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pusher/pusher-websocket-java
-
FileNotFoundException thrown when server responds with 400 or abovePosiblemente ocupada @RaphaelFakhri la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
pusher/pusher-websocket-java#261 ·
-
java.lang.NoClassDefFoundError: com.pusher.client.Pusher$$ExternalSyntheticLambda0 on Android API 21-22 anywayPosiblemente ocupada @Keith-wright la tomó hace 9 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
pusher/pusher-websocket-java#366 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
pusher/pusher-websocket-java#340 · 3 comentarios · 7 reacciones ·
-
Dificultad 4/5 1-2 días Aptitud para principiantes 8/100
pusher/pusher-websocket-java#311 · 4 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 12/100
pusher/pusher-websocket-java#308 · 2 comentarios ·
Todos los issues de pusher/pusher-websocket-java
Issues similares
-
breaking change bug needs human review not ready priority medium size S
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
martin-francois/symphony-trello#1193 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Mend: dependency security vulnerability
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
spring-projects/spring-framework#37614 ·
Los mantenedores suelen responder en 1 día