0

enter image description here

The above is what can bee seen in iOS when the Maps app goes in background state. Is it possible to achieve the same with custom apps or is it only something that Apple apps can do (e.g. Garageband)?

The behaviour is:

  • user opens Maps app and sets navigation
  • user sets Maps in background
  • iOS top navigation area becomes blue and stays visible whilst using other apps
  • once the user taps on the bar it returns to the Maps app

Those are the background modes available on Xcode:

enter image description here

Is it possible to do this for all these modes?

mm24
  • 9,280
  • 12
  • 75
  • 170
  • Yes..It's only for the Apple apps there are API's for that but that are private API's as like clock app icon continuously rotate which not in any custom app (i.e. animation on app icon) – Rahul Shirphule Sep 08 '15 at 12:44
  • 1
    ^^ That's not true @RahulShirphule Shazaam has been doing it since iOS 7 I believe. It depends on the features your including. Navigation will turn blue. And sound recording apps (GarageBand, Shazaam) will turn red and your phone calls turn green. You enable these with specified keys in your plist as well as some code – soulshined Sep 08 '15 at 12:47
  • Ooops it's my bad...! Okay probably this can be new question but can it be possible to achieve the same like clock app icon in our custom Apps ??? – Rahul Shirphule Sep 08 '15 at 12:50
  • @soulshined what are the possible features that can be enabled? Have you found some documentation on this? Would you be able to share it? – mm24 Sep 08 '15 at 13:04
  • If your asking about a maps app @mm24 then that is a possible feature. This happens in Google maps and most navigation based apps. You have to properly set your app up for background states and Apple will autonomously add the status bar to the device – soulshined Sep 08 '15 at 13:17

2 Answers2

1

Yes you can do it by setting

CLAuthorizationStatus = kCLAuthorizationStatusAuthorizedWhenInUse

instead of kCLAuthorizationStatusAuthorizedAlwaysUse and add this in your .plist

baydi
  • 1,003
  • 6
  • 11
1

you have to request when in use authorization , but this is not the trick , here is the trick

  1. click on your project in the project navigator
  2. select your target .
  3. click on the capabilities tap
  4. turn background modes one
  5. List item
  6. check the location updates check box .

of course you have to set the NSLocationWhenInUseUsageDescription property in your info.plist

  • Hello, Thanks for this. However it seems specific to apps that uses location updates. Is it possible to achieve the same with apps that do other type of background tasks? I see there are different background modes supported, is the feature of showing on the top area of the screen called "when in use"? – mm24 Sep 08 '15 at 13:01
  • @mm24 other background tasks such as ? – Abd Al-rhman Taher Badary Sep 08 '15 at 13:06
  • I just added a list of background tasks that are possible and that I am investigating.. – mm24 Sep 08 '15 at 13:22
  • 1
    @mm24 okey , for audio recording and VOIP the same banner appears but with different colours , you can test those by opening the local voice memos app in the iphone and start recording and put the app to the background a red banner will appear , and for the VOIP , open hangouts app and start a call with someone and out the app to the background a green banner will appear , if you find this helpful please up vote , also this thread may help you http://stackoverflow.com/questions/7246306/sbstatusbarcontroller-instance – Abd Al-rhman Taher Badary Sep 08 '15 at 13:28
  • Ok, thanks. I am going to investigate this properly and read carefully the other post. – mm24 Sep 08 '15 at 13:33