Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: IllegalStateException GoogleApiClient is not connected yet. #1821

Closed
1 task done
tajchert opened this issue Aug 26, 2023 · 5 comments
Closed
1 task done

[Bug]: IllegalStateException GoogleApiClient is not connected yet. #1821

tajchert opened this issue Aug 26, 2023 · 5 comments

Comments

@tajchert
Copy link

tajchert commented Aug 26, 2023

What happened?

Crash is affecting some of my users (7 of them).

Steps to reproduce?

-

What did you expect to happen?

No crash.

OneSignal Android SDK version

5.0.0

Android version

13, 12, 11

Specific Android models

No response

Relevant log output

Fatal Exception: java.lang.IllegalStateException: GoogleApiClient is not connected yet.
       at com.google.android.gms.common.api.internal.zaax.zab(com.google.android.gms:play-services-base@@18.1.0:1)
       at com.google.android.gms.common.api.internal.zabi.zaf(com.google.android.gms:play-services-base@@18.1.0:2)
       at com.google.android.gms.common.api.internal.zabe.execute(com.google.android.gms:play-services-base@@18.1.0:12)
       at com.google.android.gms.internal.location.zzau.removeLocationUpdates(com.google.android.gms:play-services-location@@21.0.1:3)
       at com.onesignal.location.internal.controller.impl.GmsLocationController$FusedLocationApiWrapper.cancelLocationUpdates(GmsLocationController.kt:224)
       at com.onesignal.location.internal.controller.impl.GmsLocationController$LocationUpdateListener.close(GmsLocationController.kt:186)
       at com.onesignal.location.internal.controller.impl.GmsLocationController.stop(GmsLocationController.kt:105)
       at com.onesignal.location.internal.controller.impl.GmsLocationController$GoogleApiClientListener$onConnectionFailed$1.invokeSuspend(GmsLocationController.kt:150)
       at com.onesignal.location.internal.controller.impl.GmsLocationController$GoogleApiClientListener$onConnectionFailed$1.invoke(GmsLocationController.kt:2)
       at com.onesignal.location.internal.controller.impl.GmsLocationController$GoogleApiClientListener$onConnectionFailed$1.invoke(GmsLocationController.kt:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1$1.invokeSuspend(ThreadUtils.kt:61)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(Builders.kt:1)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:60)
       at com.onesignal.common.threading.ThreadUtilsKt$suspendifyOnThread$1.invoke(ThreadUtils.kt:59)
       at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

Hello @tajchert thank you for reaching out!

I haven't been able to reproduce this issue. Are you able to personally reproduce this on your test devices? Or are you just getting reports of these crashes?

Could you share the OneSignal init code you are using and the OneSignal methods you are calling?

@paolo-ermit
Copy link

Same problem here.
Happened to 160 users right now

This is my init code:

class MyApplication : Application() {

override fun onCreate() {
    super.onCreate()

[...]
OneSignal.initWithContext(this, getString(R.string.onesignal_key))
OneSignal.Notifications.addClickListener(MyOneSignalNotificationOpenedHandler())
[..]
}

I've some calls to
OneSignal.login
OneSignal.logout
OneSignal.User.addTag(

But they are called later in the application

@jt-gilkeson
Copy link

jt-gilkeson commented Nov 8, 2023

Also seeing this same crash after migrating from 4.8.6 to 5.0.3 in our last release
In 4.8.6 we used to have this line as part of init - we don't have it in 5.0.3:
OneSignal.setLocationShared(false) // ANR workaround https://github.com/OneSignal/OneSignal-Android-SDK/issues/1612

I'm not sure if setting the following is needed for 5.0.x (we don't have this set currently):
OneSignal.Location.isShared = false

Additional info: all the crashes are in the background and mostly on Samsung phones so far.

It looks like when setting Location.isShared to false, OneSignal still is sending location info in the logcat?

@jt-gilkeson
Copy link

jt-gilkeson commented Nov 9, 2023

Shipped a hotfix that sets OneSignal.Location.isShared = false and updated to 5.0.4, we've had no crashes so far in OneSignal.

@jennantilla
Copy link
Contributor

Hi everyone, thanks for your patience! Just an update that a fix for this has been added in our latest release, 5.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants