https://jira.unity3d.com/browse/PLAT-8970
Currently retrieving notification on app open is not reliable on iOS. Because of asynchronous notification delivery, when app is launched by tapping a notification, on some devices it takes a frame or two to get the notification. This can cause problems, since one may want to open different scene based on whether app was opened normally or via notification. Until now recommendation to users was to wait for a couple of frames.
This PR introuduces to API: iOSNotificationCenter.QueryLastRespondedNotification() which returns an operation that can be returned from coroutine to wait until Unity determines if app was launched via notification or not. We detect if how app was launched by looking into apps launch options.
Unified API also got the same counterpart API, on Android it finishes right away.
Testing status:
Only impacts iOS and Unified APIs, direct Android API is not affected;
Only impacts retrieving responded notification & actions;
No direct dependency on device or OS version, however, the issue being solved is dependent on that (on some devices notification can be retrieved on very first frame, on others there is a small delay);
Main test project has been updated to use new APIs in both iOS specific and in Unified variant (the separate scene);
Developer testing:
Used Main testing project, both platform specific and Unified;
Devices used: iPhone 12 Pro (17.4), Pixel 5 (13)
Scenarios: with app not running or being in background open app normally, by tapping a notification, by using notification action (actions are iOS only); should show correct info about notification usage to open app (Unified scene shows notification if it was used, but only Debug.Log in case app was opened normally).
https://jira.unity3d.com/browse/PLAT-8970 Currently retrieving notification on app open is not reliable on iOS. Because of asynchronous notification delivery, when app is launched by tapping a notification, on some devices it takes a frame or two to get the notification. This can cause problems, since one may want to open different scene based on whether app was opened normally or via notification. Until now recommendation to users was to wait for a couple of frames. This PR introuduces to API: iOSNotificationCenter.QueryLastRespondedNotification() which returns an operation that can be returned from coroutine to wait until Unity determines if app was launched via notification or not. We detect if how app was launched by looking into apps launch options. Unified API also got the same counterpart API, on Android it finishes right away.
Testing status: