Skip to content

Instantly share code, notes, and snippets.

@theanilpaudel
Last active June 15, 2022 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theanilpaudel/dc53fbb90272645a9836be838f2e9d8a to your computer and use it in GitHub Desktop.
Save theanilpaudel/dc53fbb90272645a9836be838f2e9d8a to your computer and use it in GitHub Desktop.
BaseActivity.kt class for receiving the information from LocalBrodcastReceiver
// Include in BaseActivity
val logoutReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Toast.makeText(
this@BaseActivity,
getString(R.string.session_expired),
Toast.LENGTH_SHORT
).show()
FirebaseAuth.getInstance().signOut()
LoginActivity.start(this@BaseActivity)
finish()
}
}
LocalBroadcastManager.getInstance(this)
.registerReceiver(logoutReceiver, IntentFilter(Keys.ACTION_LOGOUT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment