Reputation: 815
If the app is on the background and I click on the notificaiton it is sending extras correctly to the Activity and the Activity.
However if the app is terminated or killed, clicking on the notification opens the Activity from intent.action.MAIN
which I am assuming opens the app like clicking it for the first time and ignoring the pending intent and its extras.
fun handleTimeOffRequestsNotification(context: Context, bundle: Bundle?) {
val timeOffRequestId = bundle?.getString("time_off_request_id")
val intent = Intent(context, BottomNavigationActivity::class.java).apply {
putExtra(INTENT_TYPE, IntentTypeEnum.TIME_OFF_REQUEST.name)
putExtra("timeOffRequestId", timeOffRequestId)
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
val pendingIntent: PendingIntent = PendingIntent.getActivity(
context,
0,
intent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
pendingIntent.send()
}
Upvotes: 0
Views: 39