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.

Question: `keepRunning` property in background mode

See original GitHub issue

Warning: You probably have to set your cordova app to keep running by keepRunning property to true (this is the default now).

Please let me know if I am interpreting correctly:

  1. When the app is minimized by the user (background mode) there is no guarantee that geolocation plugin will trigger a callback. To overcome this, the app shouldn’t pause in background. This can be achieved through https://github.com/katzer/cordova-plugin-background-mode by calling cordova.plugins.backgroundMode.enable(); alternative to keepRunning mentioned in docs (please consider adding this <platform name="android"> ... <preference name="KeepRunning" value="false" /> )
  2. When app is in background I get 2 notifications: a) The app is running in background doing heavy task and b) App is running. Touch for more info. Is there any way I can remove these? Or lower it down to one?
  3. If point 1 is correct would this cause issues during IOS app review, as the app would always keep running in background?
  4. When the user kills/force-stops the app(not background mode), geolocation plugin will continue logging location in local db and callback won’t be triggered. These location can then be retrieved by calling backgroundGeoLocation.getLocations(success, fail). [Android Only]
  5. Point 4 function backgroundGeoLocation.getLocations(success, fail) is Android only, what happens in case of IOS?
  6. If point4 is correctly interpreted, how do I know if there are locations stored in local db?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
christocracycommented, Jun 4, 2016

Of course it sets UIBackgroundMode "location", this is a background-geolocaiton plugin!

However, the only way that iOS will keep your app from being suspend with this mode is if location-services are engaged, ie: the GPS radio is ON and sucking power. You could do this but the user’s battery will die in a few hours and your users will hate you. The second you turn off location-services, iOS will immediately put your app to sleep.

I originally designed this plugin for a disaster-response application, tracking first-responders into hurricanes & earthquakes, in an environment where the network is likely destroyed. The core philosophy of my work is tracking the device in the most battery-efficient manner possible. That means that location-services must be engaged only when the device is detected to be moving and turned off ASAP when the device is stopped.

The differences between this plugin and my new version are vast. I’m probably about 1500 hours ahead of this fork. I’ve completely refactored both Android & iOS during the past 17 months-or-so after I put it up for sale. Since that time, I make enough sales that I’m able to devote every single hour of my time to supporting the plugin. I’m supporting hundreds of paying customers now. It’s not a side-project for me, it’s my full time job.

I’ve extracted the core native functionality into pure native frameworks for each platform, completely decoupled from Cordova. I sell the same plugin now for React Native and I’m considering porting it to NativeScript by Telerik. Each framework I port-to requires just a small facade in front of the same core native framework.

AirBnb is one of my customers

iOS is free but you have to purchase a license for Android. You can try Android with my SampleApp, which contains a license-key that unlocks the Android plugin only only for the SampleApp app’s bundle ID.

1reaction
christocracycommented, Jun 4, 2016

And @mauron85 if you ever want to try my Android version, I’ll give you some license keys. email me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Background Modes Tutorial: Getting Started
This property identifies the task request to run in the background. Next add the following method to CompleteTaskModel just before ...
Read more >
Using UIBackgroundModes to run code in background mode
I want to keep running my server fetching code and playing some sound based on the server response even when my application is...
Read more >
How can I have my script running in the background ...
I have the following powershell script that sends an email whenever a new file is created/copied to a specific folder. the only problem...
Read more >
put a running program into background like screen
The typical way to do this is with CTRL-z to suspend the process, and then bg to resume it in the background. Once...
Read more >
katzer/cordova-plugin-background-mode - GitHub
Keep app running in background. Contribute to katzer/cordova-plugin-background-mode development by creating an account on GitHub.
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