If device is out of memory, plugin start service automatic
See original GitHub issueYour Environment
- Plugin version: Alpha 50
- Platform: Android
- OS version: 8.0.0
- Device manufacturer and model: Any
- Running in Simulator: Yes, same issue
- Cordova version (
cordova -v
): 8.1.2 - Cordova platform version (
cordova platform ls
): Android and iOS - Plugin configuration options: doesn’t matter, happens all time
- Link to your project:
Context
So… if your App is startet, and these plugin is loaded (and configurated) - just minimize the app, and run the device out of memory (with a lot of apps, or with the Fill RAM memory app) within 60 secounds after minimize, and the plugin starts a LocationService automatic - u cant stop it!
If u wait longer thant 60 seconds the background service will stop by os or plugin and don’t start automatic.
I think the problem is, that if u call stop() - the attempt the serice to kill, but dont do it immediately. It will be killed after 60 seconds.
The central issue is, that u cant do anything. The device track the location all time, untill u kill the app in taskmanager.
Expected Behavior
LocationService should stop immediately after calling stop().
Actual Behavior
The LocationService runs 60 secs longer. If the app got killed caus device is out of memory, the LocationService start and dont stop to track.
Possible Fix
Kill Service immediately
Steps to Reproduce
- Start App and configurate Plugin
- Minimize the App
- Run device out of memory in 60 seconds
- It starts tracking automatic
Context
I cant use these plugin, caus no one wants a app whos tracking u all time. I tried tausends of configurations, tried to do something on “resume ore pause” events on Corodva, but the dont trigger on out of memory. I tried to call stop() at every event from the Plugin, but it dont stops after automatic restart…
Debug logs
This is what happend after killed within 60 secs:
I/com.marianhello.bgloc.service.LocationServiceImpl: Creating LocationServiceImpl I/com.marianhello.bgloc.PostLocationTask: Creating PostLocationTask W/com.marianhello.bgloc.service.LocationServiceImpl: Attempt to start unconfigured service. Will use stored or default. I/com.marianhello.bgloc.service.LocationServiceImpl: Network condition changed has connectivity: true D/com.marianhello.bgloc.service.LocationServiceImpl: Will start service with: Config[distanceFilter=3 stationaryRadius=3.0 desiredAccuracy=0 interval=10000 fastestInterval=120000 activitiesInterval=10000 isDebugging=false stopOnTerminate=true stopOnStillActivity=true startOnBoot=false startForeground=true notificationsEnabled=false locationProvider=0 nTitle=Background tracking nText=ENABLED nIconLarge= nIconSmall= nIconColor= url=https://[HIDE] syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate={“acc”:“@accuracy”,“alt”:“@altitude”,“lon”:“@longitude”,“lat”:“@latitude”,“speed”:“@speed”}] I/com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider: Creating DistanceFilterLocationProvider I/com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider: Start recording
Than i goes the normal tracking way…
Hopy anyone has an idea. But i love these plugin!
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (4 by maintainers)
Top GitHub Comments
@mauron85 all our hopes rest on you! : D
Should be fixed in v3.0.0.