iOS: is it possible to get an app to show on the top area of the screen whilst in background? - ios

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:
Is it possible to do this for all these modes?

Yes you can do it by setting
CLAuthorizationStatus = kCLAuthorizationStatusAuthorizedWhenInUse
instead of kCLAuthorizationStatusAuthorizedAlwaysUse
and add this in your .plist

you have to request when in use authorization , but this is not the trick , here is the trick
click on your project in the project navigator
select your target .
click on the capabilities tap
turn background modes one
List item
check the location updates check box .
of course you have to set the NSLocationWhenInUseUsageDescription property in your info.plist

Related

What Is This Top Indicator View Called And Can You Use It?

The screenshot below shows the top indicator view displayed while the Apple Map app is tracking user location and when you take a screen recording on your iOS device. What is this top indicator view called? Also, can we create and display this view from our own custom apps? For example, if my app is tracking user location, can I display a green version of this view while my app is running in background? If so, how do you access it?
No. You cannot affect what the user sees on the home screen (except to badge your icon).
If your app is tracking user location, the user is notified of that fact by the system; there is nothing for you to do. If you have Always authorization, it would be nice to set the location manager's showsBackgroundLocationIndicator to true, but that's all you can do.

Remove "Using your location blue banner" When location popup select "Only while using this app" Option

I just build my app with the iOS 11 SDK using location service. Now my issue is when for app is open then iOS display location alert with three option "Always Allows", "Only while using this app", and "Don't allow"
When user is select "Only while using this app" and enter in application.
When user is minimise app then top bar display with "AppName is actively using your location"
Now my question is how to remove top banner ?
Check screen:
IMAGE HERE
Thanks in Advance.
You can not. Whilst your app, either in the background or foreground uses location services, the device is going to let the user know.
If you don’t need location while the app is in the background, inside your AppDelgate you can pause the listener inside the applicationWillEnterBackground and then restart it when the user reopens the app inside applicationWillEnterForeground
When user select Only while using this app don't take location in the background just by doing this
locationManager.allowsBackgroundLocationUpdates = false
By doing this it will not show the blue bar when your app went in background.
P.S you can set allowsBackgroundLocationUpdates = true if you have the permission of Always Allows.

Prevent Location blue bar in ios 11

As you already heard, in iOS11, an app that’s actively receiving continuous background updates will show a double-height blue bar, whenever authorization is set to While Using. It seems there is no way to remove the blue bar if the App is using background location App.
My app supports ios 9.0 and above and, I have added all the keys required in info.plist including the one below.
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string></string>
But seems everybody says there is no way to remove the blue bar while background location updates is working.
However I have installed UBER and somehow they managed to hide the blue bar when the app is in background, but in my app I can see blue bar when I put app in background.
Does some one knows any solution to get rid of blue bar in iOS11 when we set permission "while using the app" ?
In iOS 11, the Blue Bar will appear when an Always authorized app opts-in to displaying the blue bar while it is actively receiving Continuous Background Location updates via startUpdatingLocation()
There’s a new property on CLLocationManager that Always authorized apps can use to control the visibility of their blue bar.
#property(assign, nonatomic) BOOL showsBackgroundLocationIndicator
When-in-use authorized apps will continue showing the Blue Bar as before.
No other service will turn on the Blue Bar. When an app which makes use of any other location service receives an occasional update (for example Significant Location Change), the location arrow on the status bar will momentarily blink solid, but the Blue Bar will not appear.
According to apple , After iOS 11 update that blue bar is showing when app is running on the background. What you can do is, track user location when app is in the foreground.
Check this
Try with NSLocationAlwaysUsageDescription in info.plist file and use requestAlwaysAuthorization in CLLocationManager.
showsBackgroundLocationIndicator is useful for requestAlwaysAuthorization.

iOS Location status message on background doesn't show

I've implemented a CLLocation like waze to get the users location on background mode, I want to show the bar like "incall" showing that I'm getting the location.
I don't know why the bar doesn't show, I have in the info.plist this
Key : NSLocationAlwaysUsageDescription.
I assume you are talking about the blue "navigation" bar that appears under the status bar.
That only appears when an app is being used for navigation. An app that simply gets location in the background does not show the blue bar (or any other color bar).
If you requestAlwaysAuthorization the bar will not appear (because you could use location services at any time). The bar appears only when you requestWhenInUseAuthorization and the app asks to keep receiving location updates while in the background.
See the documentation for requestWhenInUseAuthorization (emphasis added):
If the user grants “when-in-use” authorization to your app, your app
can start most (but not all) location services while it is in the
foreground. (Apps cannot use any services that automatically relaunch
the app, such as region monitoring or the significant location change
service.) When started in the foreground, services continue to run in
the background if your app has enabled background location updates in
the Capabilities tab of your Xcode project. Attempts to start location
services while your app is running in the background will fail. The
system displays a location-services indicator in the status bar when
your app moves to the background with active location services.
This line about the "location-services indicator" is notably absent from the documentation for requestAlwaysAuthorization.

In-Navigation Status Bar iOS

Google maps already has a blue bar that appears whenever you are in navigation. I want to know how I can implement this myself. Any ideas?
Configure your app to use Core Location in the background. And when, as you must now do in iOS 8, you come to request authorization, request When In Use authorization.
The blue bar will then appear automatically whenever your app is using core location in the background.

Resources