Skip to content

Instantly share code, notes, and snippets.

@seoft
Created March 28, 2021 15:33
Show Gist options
  • Save seoft/f8cd7cd8f69b5b0f60a6448e9c3cebb2 to your computer and use it in GitHub Desktop.
Save seoft/f8cd7cd8f69b5b0f60a6448e9c3cebb2 to your computer and use it in GitHub Desktop.
processRemoteConfig4.kt
processRemoteConfig4.createRxSingleRemoteConfig()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
it.run {
when (this) {
is RemoteConfigResult.Run -> {
Log.d(TAG, "onRun $message $etc")
startActivity(Intent(baseContext, MainActivity::class.java))
finish()
}
is RemoteConfigResult.LowVersion -> {
Log.d(TAG, "onLowVersion $message $etc")
// message is "Get a new version from the Play Store"
Toast.makeText(baseContext, message, Toast.LENGTH_LONG).show()
finish()
}
is RemoteConfigResult.Block -> {
Log.d(TAG, "onBlock $message $etc")
Toast.makeText(baseContext, message, Toast.LENGTH_LONG).show()
finish()
}
}
}
}, {
it.printStackTrace()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment