Created
February 4, 2019 14:34
-
-
Save dkhmelenko/4833d39283b715d50330d5714b885a85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lateinit var googleApiClient: GoogleApiClient | |
private var googleApiClientSubject = PublishSubject.create<GoogleApiClient>() | |
fun init() { | |
googleApiClient = GoogleApiClient.Builder(context) | |
.addConnectionCallbacks(object : GoogleApiClient.ConnectionCallbacks { | |
override fun onConnected(connectionHint: Bundle?) { | |
googleApiClientSubject.onNext(googleApiClient!!) | |
} | |
override fun onConnectionSuspended(cause: Int) { | |
googleApiClientSubject.onError(Exception("GoogleApiClient connection suspended,: $cause")) | |
} | |
}) | |
.addApi(Auth.CREDENTIALS_API) | |
.build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment