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

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.

Related

Change text in status bar while app in background

I want to change the text of red bar shown below, how do I do it? I see it when my swift app is currently using the microphone and is in the background.
You cannot change it yourself.
This is a system level event that occurs when your app is running in
background stage and using services like location, audio, etc. This
link discusses about the types of background services an app can
use.

In-call status bar for app

I would like to know if there is a way to make your app show a status bar when the app is performing a specific function. Sort of like Shazam does when Auto Shazam is on, but this might be because the microphone and not something in Shazam's app code but I am wondering if there is a way to programmatically achieve this. Preferably in Swift but Obj-C also works.
This isn't done directly by the app, this is done by the OS when the app is using one of a few features in the background
The bar is red when an app is using the microphone in the background.
The bar is blue when an app is accessing location in the background.
The bar is also blue when a device is connected to the Personal Hotspot.
The bar is green when the telephone (including WhatsApp) is being used.
There may be more colours for other scenarios, but these are the ones I've come across.
I don't know of a way to add this bar on demand.

iOS Multitask App Switcher Custom Image

im developing an iOS App and i would like it to behave like PayPal when the user double taps the home button.
For those who dont know the PayPal app displays a custom image when the app is displayed on the multitask switcher but it doesnt when a notification arrives or when the user pulls the notifications bar.
My issue comes when implementing this, im using the event applicationWillResignActive to display my custom image (as applicationEnteredBackground is not called for this). But this method is called on events on which i dont want the app to display the image (such as notifications, calls, pulling the top bar, etc).
Is there any way of setting this image only when the home button is double tapped?
Thank you!
From what I see, PayPal doesn't cover the viewport with a custom image immediately – when I double tap the Home button, it remains rendered normally until I do something else – but most probably on applicationDidEnterBackground:. After switching to Home screen or another application, the PayPal preview becomes covered.
On the other hand, my mobile banking application does that immediately when applicationWillResignActive: is triggered.
These are AFAIK the only two approaches you can achieve.

IOS Text below Status Bar while app is in Background

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.

How To Implement Apparently System-Wide Changes (Status Bar, Dock) in iOS7?

I recently noticed that there are some apps in the iOS app store which claim to be able to change the color of both the status bar and the dock of the iOS Springboard. This seems impossible because such system-wide changes are almost never allowed by Apple, and after some googling I have found no answer. Here is an example of a dock color changing app, and here is an example of a status bar changing app.
Searching SO appears to bring up code for changing the status bar in the app, which is not very difficult, but not outside of the app. However, this functionality has clearly existed for a while, for example in the Voice Memos native iOS app, which turns the status bar red while recording.
Lastly, apps such as voice Memos and the native Music app appear to bring up special controls or animations when in use on the lock screen. It is possible to use the built-in iPod lock screen controls for other music apps, (see here), but I have seen no examples of custom lock screen app controls that made it through the app store.
Sorry to pack so many questions in one, but these are all examples of apparent across-system functionalities which I and likely many others would like to replicate, and thus merit attention.
As a postscript, is it possible that the color changes in dock and status bar are done but changing those parts of the wallpaper extremely so that when seen through the translucent UI they look like less bright but still noticeable colors? Thanks!
All of the examples app you have given just change your background. Since the statusbar and dock are translucent they change color when you set the background made with these app as you background.
The red bar from the voice memos is a system indication that some app is recording, this is not something you can change. The The status bar will become green when you there is an active phone call going and you open any app. The same with tethering.
You can not add any custom lock screen controls, there is no option for this in the SDK.

Resources