KMPNotifier and Kotlin version:
kmpnotifier version: 1.3.0, kotlin version: 2.0.21
Describe the bug.
The FLAG_ACTIVITY_CLEAR_TOP avoids multiple stacked instances of the launcher activity in android. However, this might not be the most appropriate way to start the activity for some users/use cases.
E.g. if the app is loaded in UI, it will reload the app (in my case it should not happen).
There should either be an option to skip this intent config or to allow passing flags (more robust for future uses).
Inside AndroidNotifier.kt, the intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) should be optional or configurable.
private fun getPendingIntent(payloadData: Map<String, String>, id: Int): PendingIntent? {
val intent = getLauncherActivityIntent()?.apply {
putExtra(ACTION_NOTIFICATION_CLICK, ACTION_NOTIFICATION_CLICK)
payloadData.forEach { putExtra(it.key, it.value) }
val urlData = payloadData.getOrDefault(Notifier.KEY_URL, null)
urlData?.let { setData(Uri.parse(urlData)) }
}
intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val flags = PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
return PendingIntent.getActivity(context, id, intent, flags)
}
In which platform bug occurs?
android
To Reproduce
Steps to reproduce the bug:
- launch any notification on android
Expected behavior
Avoid reloading the app activity when notification is clicked
KMPNotifier and Kotlin version:
kmpnotifier version: 1.3.0, kotlin version: 2.0.21
Describe the bug.
The
FLAG_ACTIVITY_CLEAR_TOPavoids multiple stacked instances of the launcher activity in android. However, this might not be the most appropriate way to start the activity for some users/use cases.E.g. if the app is loaded in UI, it will reload the app (in my case it should not happen).
There should either be an option to skip this intent config or to allow passing flags (more robust for future uses).
Inside
AndroidNotifier.kt, theintent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)should be optional or configurable.In which platform bug occurs?
android
To Reproduce
Steps to reproduce the bug:
Expected behavior
Avoid reloading the app activity when notification is clicked