question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No location in background on iOS when authorization is "WhenInUse"

See original GitHub issue

Your Environment

  • Plugin version: 2.3.6
  • Platform: iOS
  • OS version: 12.1
  • Device manufacturer and model: iPhone 6S
  • Running in Simulator: No
  • Cordova version (cordova -v): 8.0.0
  • Cordova platform version (cordova platform ls): cordova-ios 4.5.5
  • Plugin configuration options:
var config = {
           PauseLocationUpdates : false,
           desiredAccuracy: 0,
           stationaryRadius: 5,
           distanceFilter: 5,
           debug: false,           
           stopOnTerminate: true,
           interval: 3000, 
           notificationTitle: 'Coach AAC', 
           notificationText: 'Trajet en cours', 
           fastestInterval: 1000, 
           useActivityDetection: false 
        };
  • Link to your project: N/A

Context

I need to retrieve locations when the app is in background. It works well on iOS when I select the “Always” authorization but I would like to use the “WhenInUse” because with this mode, a notification is displayed on screen in background.

Retrieving locations in background with the “WhenInUse” authorization works fine with Christocracy plugin but not with your plugin. The blue notification is display for few seconds when I put the application in background but no location is given by the plugin. Then , the notification disapears and I still don’t get any location (in background).

Do you have any idea to make this configuration works or do you know if there any other solution to use the “Always” authorization and having a notification ?

Expected Behavior

background notification saying that the gps is in use

Actual Behavior

(WhenInUse authorization ) : Notification for few seconds and then and no position retrieved in background (Always authorization ) : No notification but get normal locations in background

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eommercommented, Dec 11, 2018

Thanks for your quick answer. Yes but it was working in background, with this authorization, with the Christocracy plugin. I don’t know how it was possible, but it allowed me to have the notification.

Do you have any idea of how I could retrieve locations in background (with the “Always” auth) and still have a blue notification displayed ?

0reactions
stale[bot]commented, Sep 11, 2019

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn’t be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it’s important. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Choosing the Location Services Authorization to Request
In general, iOS apps are considered in use when they're in the foreground or running in the background with the background location usage...
Read more >
Impact of iOS13 & iOS14 location permissions on background ...
Let's understand each permission and its impact on location access. When In Use. iOS 13 considers the app in use from the time...
Read more >
ios - Location Background Mode Always or WhenInUse
I have two apps built that use your location similar to a run tracking app where I use the location in the background...
Read more >
[expo-location] ios doesn't support background when-in-use
According to Apple: the "when in use" permission should allow you to use location services when the app is running in the foreground...
Read more >
Understanding New Location Permission Changes in iOS 13
“Allow Once”. Prior to iOS 13, there were two location permissions: When In Use (foreground) and Always (background). iOS ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found