Android Kotlin Pusher error Start method must be called before setUserId pusher
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 15/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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???
- Vorherrschende Sprache
- Java
- Sterne
- 315
- Forks
- 140
- Ø Merge
- 11 T. 5 Std.
- Gemergte PRs (30 T.)
- 4
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus pusher/pusher-websocket-java
-
FileNotFoundException thrown when server responds with 400 or aboveEvtl. vergeben @RaphaelFakhri hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
pusher/pusher-websocket-java#261 ·
-
java.lang.NoClassDefFoundError: com.pusher.client.Pusher$$ExternalSyntheticLambda0 on Android API 21-22 anywayEvtl. vergeben @Keith-wright hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
pusher/pusher-websocket-java#366 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
pusher/pusher-websocket-java#340 · 3 Kommentare · 7 Reaktionen ·
-
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 8/100
pusher/pusher-websocket-java#311 · 4 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 12/100
pusher/pusher-websocket-java#308 · 2 Kommentare ·
Alle Issues in pusher/pusher-websocket-java
Ähnliche Issues
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpathEvtl. vergeben @ZARAYACH hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
micronaut-projects/micronaut-serialization#1494 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
Maintainer antworten meist innerhalb von 2 Tagen
-
code-health feature/sync OS/Android QA/Test-Plan-Specified QA/Yes
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
brave/brave-browser#60327 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Type: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
it-at-m/raumreservierung#383 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
aws/context-ontology-accelerator#325 ·
Maintainer antworten meist innerhalb von 1 Tag