When Apple's official iOS Messages app is open and in the foreground, new messages from other contacts trigger a stock, native iOS notification alert banner. See image below.
Is this possible in 3rd party apps on the App Store? Local and/or Push Notifications for your app while your app is open and in the foreground?
When testing my app, notifications are received but no iOS alert UI is shown.
But this behavior is seen in Apple's official Messages app:
The Local and Remote Notification Programming Guide says:
When the operating system delivers a local notification or remote notification and the target app is not running in the foreground, it can present the notification to the user through an alert, icon badge number, or sound.
If the app is running in the foreground when the notification is delivered, the app delegate receives a local or remote notification.
So yes, we can receive the notification data while in the foreground. But I see no way to present the native iOS notification alert UI.
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
// I know we still receive the notification `userInfo` payload in the foreground.
// This question is about displaying the stock iOS notification alert UI.
// Yes, one *could* use a 3rd party toast alert framework.
[self use3rdPartyToastAlertFrameworkFromGithub]
}
Is Messages then using a private API to display the alert while in the foreground?
For the purpose of this question, please do not suggest any 3rd party "toast" pop-up alerts on github or etc. I'm only interested if this can be done using the stock, native iOS Local or Push Notification alerts UI while your application is open and in the foreground.