IOS Text below Status Bar while app is in Backgrou

2020-04-21 07:17发布

问题:

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?

回答1:

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.