Do not use current activity as an option anymore; this is wrong - it only works as long as you don't kill the app, while for notifications the most essential part is precisely to work well after the app was killed.
Fail initialization if we cannot determine the activity to open, so user knows in advance that something is wrong.
If activity to be opened is not explicitly specified by the user, loop over activities in the application and select either the Unity one or the only one, fail if there are multiple choices.
Tested by developer/automation:
Having either Activity or GameActivity chosen works as expected
Having both enabled in Player Settings fails initialization logging the exact reason
Testing required:
Explicitly specify the activity class in notification settings, that one should be used no matter how many other activities you have
Having extra activities in project should pick the Unity activity, if only one such is present
When project has only one enabled activity, that one should be used
Try reschedule after boot
Hints:
Not specific to Android device or version, Unity version only matters for GameActivity part
The easiest way to test is to enable both activity types and specifying custom activity for notifications, then export the Android Studio project and play there by modifying manifest in the unityLibrary project and adding activities via IDE (custom activity is in the manifest as meta data)
You can enable/disable activities in the manifest, we only care about enabled ones
To have no Unity activity, make a class that extends one of Unity activities and use this new class in the manifest instead of Unity one
https://jira.unity3d.com/browse/MNB-36 Support GameActivity. Our notifications open an activity when tapped. Changes:
Tested by developer/automation:
Testing required: