[Location Plugin] Background mode not returning coords

[Location Plugin] Background mode not returning coords

  
Forge Component
(17)
Published on 2016-12-15 by OutSystems R&D
17 votes
Published on 2016-12-15 by OutSystems R&D

Hi guys,

I'm trying to use this plugin to track a users location, both while the app is open and while the app has moved to background mode.

Using the plugin in foreground works perfectly, however when using the plugin in background, the coords returned are 0.

Any ideas why its returning 0 values.

Hello Leeroy.

The issue happens because when the app goes to background it stops executing javascript code. To avoid this, you can use a plugin like BackgroundMode Plugin (Forge).

This plugin will "prevent the app from going to sleep while in background". Keep in mind that it has implications (e.g.: consume extra battery).

Thanks

Hi César

I'm currently using the Background mode plugin.
I can get javascript to run, like to update the notifcation that comes with Background mode , but when trying to use the "GetLocation" and save that to the server while in Background mode, the lat and long are 0 values.


Is this perhaphs a limitation of the Location plugin, that it can only obtain co-ords in a foreground setting?

Hey, Leroy,

Are you using iOS? If so, have you checked if your app's location service settings are set to "Always" instead of "While using the app"? This screenshot shows the menus to navigate to.

I have also seen people using the Background Location plugin to this effect in the past, so it might be worth having a look at, as well.

Best regards,

Carlos

Hi Carlos

I am currently making use of the background plugin.
this is more or less what I have done so far.

1. My onready action has a javascript, that triggers another action after a set amount of miliseconds, in this case, it will trigger SaveLocation every 10 seconds.

2. The savelocation will check if app is in background mode or not. If in foreground it gets location and saves it. This work perfectly. When it is in background mode, it "tries" to get the location and executes my Saveloca action. In the Saveloca action, I take the lat and long and write it to my DB, and use text to speech as a cue to let me know that it executed.



All this works, it is just the "GetLocationwhileinbg" action is returning 0's and passing those 0's into SaveLoca.


I have tried replacing the "GetLocationwhileinbg" action that makes use of the location plugin, with another plugin's action , namely Background Location Plugin. and it actually saved a value, however only saved once, after it saved the first time, I get a warning.
"License Validation Failure BackgroundGelocation is running in Evaluation Mode" 


I am attempting to get hold of the developer to obtain a license

Hey again, Leroy,

Didn't know the plugin needed a license :\. If it's accessible enough for you to acquire, it might be worth it.

If not, what about the iOS setting I referred to? You didn't mention it on your post and it might be related...

Carlos Simões wrote:

Hey again, Leroy,

Didn't know the plugin needed a license :\. If it's accessible enough for you to acquire, it might be worth it.

If not, what about the iOS setting I referred to? You didn't mention it on your post and it might be related...


Hi Carlos, apologies, I have not even tested on an Apple device.
Literally just build a quick mobile app in outsystems, generated apk and slapped it on my android phone.

No worries! Hmm, ok, that's out of the picture for now, then.

I've checked and it looks like Android "Release" builds that use the plugin will also need a license, so take that into consideration when evaluating it.

This is a critical component for me. Please use all generated apk and slapped it on my android phone. thanks.