Reputation: 354
So I am using extremepush to send pushe notification in my android app. problem that I have is when I'm killing app from background (killing app by swiping with finger) and then press on received push notification it starts app's last activity which I was on it before killing app
class ExampleApp : Application(), DeeplinkListener {
companion object {
var currentDeeplinkReceived: String? = null
}
override fun onCreate() {
super.onCreate()
startIntegrity()
PushConnector.Builder(BuildConfig.XTREME_PUSH_KEY, BuildConfig.FB_SENDER_ID)
.setEnableStartSession(true).apply {
if (BuildConfig.DEBUG) turnOnDebugMode(BuildConfig.DEBUG)
}.setDeeplinkListener(this).create(this)
}
override fun deeplinkReceived(link: String?, uiReference: WeakReference<Context>?) {
uiReference?.get()?.let { context ->
link?.let { deepLinkValue ->
handleDeepLink(deepLinkValue, context)
} ?: "deep link empty"
} ?: "deep link empty"
}
I tried to check context but context is always last activity
private fun handleDeepLink(deeplinkValue: String, context: Context) {
currentDeeplinkReceived = deeplinkValue
if (context !is GameActivity && context !is WebViewActivity) {
if (context !is LoginActivity) {
val intent = Intent(context, BottomNavigationActivity::class.java)
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP
)
startActivity(intent)
} else {
val intent = Intent(this, LoginActivity::class.java)
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP
)
startActivity(intent)
}
} else {
currentDeeplinkReceived = null
}
}
Upvotes: 0
Views: 18