[flutter_local_notifications] Add support for specifying custom Activity to open on notification tap (Android)
Changes
- Added an optional initialization parameter for specifying the target Activity name.
- If the parameter is not provided, the default behavior remains unchanged.
Why
In some applications, the default launcher Activity is not suitable as a notification entry point. This enhancement gives developers more flexibility and control over app navigation from notifications.
Notes
- Backward compatible: existing code without the new parameter continues to work as before.
Thanks for the PR and sorry for the delay in getting back. I'll need to test this out but do you have some examples where an app shouldn't use the default activity? I have some further thoughts on this but wanted to know before I share
I need this functionality primarily to help migrate a large existing application to Flutter.
However, the improvement isn't limited to migration. It also allows for greater isolation of specific flows. For instance, launching certain activities with FLAG_ACTIVITY_NEW_TASK (e.g., for in-app purchases or specific login flows) or catering to specific security use cases where task separation is required.
Thanks for more details on this. Based on what you said, as initialisation is supposed to be a one-time thing, perhaps it would be more beneficial if the activity could be set per individual notification?
That's a great suggestion and certainly an improvement over my current approach. I'll need to think about the best way to implement that change.