Last active
June 15, 2022 14:32
-
-
Save theanilpaudel/dc53fbb90272645a9836be838f2e9d8a to your computer and use it in GitHub Desktop.
BaseActivity.kt class for receiving the information from LocalBrodcastReceiver
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
// 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