I'm new with working with notifications in my app so please bear with me. I have a pending intent which will navigate to MainActivity when the user clicks on it. I want to change it so that it navigates to a fragment that has navigation arguments.
My code for pending intent
val notifyIntent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
data = Uri.parse(uri)
}
return PendingIntent.getActivity(
context, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT
)
Navigation action for my fragment
NavigationGraphMainDirections.actionGlobalManagePostFragment("data")
I don't know if I have to send the string of data with the notification and get it back with the pending intent. What is the solution here?