IOS Text below Status Bar while app is in Background - ios

I'm trying to figure out how to implement a banner like notification with text below the statusbar while an app is in the background.
Much like Runkeeper, while active and app is in background:
Is it a Banner? All I can find for that is banners for ads while the app is in the foreground.
Do I need to customize the StatusBar and add an extra view for the StatusBar with a custom text to appear?
Is it a customized UILocalNotification to be continuously shown?

This banner is displayed by iOS itself in the following situations:
A background app is tracking your position (after a startUpdatingLocation)
A background app is using your microphone
A background app is performing a VOIP call
The banner color changes with the reason.
There is no way to force iOS to display those banners but by using one of the relevant background modes.

Related

iOS: How to display a banner notification with a dark theme

I want to display a banner notification with a dark background and light text. iOS naturally does this if the phone is using dark mode. However, in light mode, when I use WhatsApp, I noticed banners have a dark theme as long as they are displayed while the application is in the foreground.
How can I create something similar? I've been looking into using UNNotificationContentExtension. This seems to work for custom actions displayed via a long click. For example, when I set view.backgroundColor, this does not set the background color for the whole banner. It only does it for custom actions.
This isn't possible, since the system manages the creation of these alerts. This is probably restricted for consistent UI.

UI-Test with XCTest: how to trigger App-State Foreground-Inactive Foreground-Active

How can I trigger the following behavior in Swift UI Tests via XCTest:
Get the app to foreground and inactive (applicationWillResignActive) and back to "foreground and active" (applicationDidBecomeActive)
Possible gestures, while app is in foreground and active, could be:
open app switcher and go back to app
open control center and hide control center
open notification center and hide notification center
I searched for something like that following fictive(!) code XCUIDevice.shared.doublePress(XCUIDevice.Button.home) or XCUIDevice.shared.swipeDownFromOutside(); XCUIDevice.shared.swipeUpFromOutside().
Or a more better way a method call to simulate an open app switcher, control center or notification center immediately.
Or in the best way to simulate the status applicationWillResignActive, applicationDidBecomeActive immediately.
Important to understand: the event applicationDidEnterBackground must not called - the app has to stay in foreground (but inactive)!
So recently on wwdc2017 Apple released a convenient way to work with multi app. You can see the multi App portion of the video link below.
https://developer.apple.com/videos/play/wwdc2017/409/

IOS - Add message to status bar

How to add message to status bar when I using geolocations. Like the image below
As #Quentin Hayot described here
This banner is displayed by iOS itself in the following situations:
A background app is tracking your position (after a startUpdatingLocation)
A background app is using your microphone
A background app is performing a VOIP call
The banner color changes with the reason. There is no way to force iOS
to display those banners but by using one of the relevant background
modes.
If your app does not tracking position, using microphone or performing a VOIP call, you will not able to display that bar.

Is there any way to change notification image

i want to show or change present image in notification with latest image icon, the image icon will be provided either in the notification data or saved previously in the app like this one and this one image
i want that if notification came on the IOS device then the image in the notification will show accordingly
this text from iOS Human Interface Guidelines
A banner is a small translucent view that appears onscreen and then disappears after a few seconds. Users can also see a version of the banner on the lock screen and in the Notifications view of Notification Center. In the banner, iOS displays your notification message and the small version of your app icon (to learn more about the small app icon, see App Icon). Users tap the banner to dismiss it and switch to the app that sent the notification.
I believe that you can't change it, but may be if you change some pictures in App icon source, you will achieve the necessary result, but I repeat, hardly everything will correctly work
for example
U can try to change Spotlight images or any else....

Custom notification when app in background or close

Is it possible to create an notification when my app in background all close.
What I mean:
If my app goes to background at some point at time I want to get notification with alert view on main screen in iPhone.
Alert view have to contain my custom description text.
Is it possible? and if this is possible that wich verion iOS should provide this option.
Thanks!
Yes, you can use a local notification.
https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
Local notifications were introduced in iOS 4.0

Resources