Q: How can I tweak Settings/Location to switch on/off the GPS receiver directly, independent if an app asks for position data or not?

Q: As title says, I want to switch on or off the GPS reveiver of the device directly by Settings/Location for the purpose that it has valid position data immediately as soon as (later) an app (GPSInfo or navigation app) is started and asks for them.

Present state is: Settings/Location enables the GPS receiver for demands from app, but GPS receiver isn’t really turned on in fact. It’s only enabled for the case an app will ask for GPS data. GPS receiver starts not before an app really asks for GPS data. Therefore the app (and also the user) has to wait until the GPS receiver has position fix, before he can work with the app.

What I want: Settings/Location should directly turn on the GPS receiver, so that it starts searching for satellite sync immediately and reach position fix a few minutes later and have it available without further waiting time when starting an app few minutes later. Starting the GPS receiver should no more wait until an app asks for position data.

I’m sure this behavior is ‘tweakable’ in the user accessible .qml files of the currently existing Settings/Location control, but unfortunately I couldn’t find it until now. So please help me!

Thanks for any suggestions!

Device is Xperia 10 / SFOS 4.5.0.24

situation to start gpsinfo on gps activation ?

1 Like

No special situation, not a bug, I’m aware that the existing behavior is intended by Jolla to save battery if Location is on but no app is asking for position data at a moment. But I want to tweak for my special usecase.

My Settings/Location is:
Location (the first item, ‘Standort’): on or off switched manually depending on situation,

under accuracy: “Exclusive Device Mode” OR “individual settings” and then again GPS on + OfflineMozilla off + MLS off (both tested and got the same result).

i ve ment situations, the app.
it should be possible to react on gps-on and start gpsinfo, the app, which then should wake up phone to get the current location

1 Like

Situations app is not installed.

edit: Can I tweak something in
/usr/share/jolla-settings/pages/gps_and_location/location.qml ?
At the first glance this looks very promising, but my knowledge is limited.

edit: Found in location.qml, line 172-174

onClicked: {
    setMode(LocationConfiguration.DeviceOnlyMode)
    root.checkFlightMode()

As I understand, this is what happens if Device-only-mode is selected.
So question is, where is LocationConfiguration.DeviceOnlyMode defined?
It would be good, to apply the tweak only to the device-only-mode and not affect other modes, because on the other modes the present behavior is senseful.

edit: found /usr/share/csd/pages/GpsStateRestorer.qml

Not sure about switching off, but for updating location in the background, gpscon can be used:

/usr/bin/gpscon --script --fout --posm=all limit=250 interval=5000 tout=60

https://openrepos.net/content/halftux/gpscon

1 Like

For enabling/disabling GPS, connman seems to have an interface:

 busctl call  net.connman /net/connman/technology/gps net.connman.Technology GetProperties
a{sv} 5 "Name" s "Gps" "Type" s "gps" "Powered" b true "Connected" b false "Tethering" b false
devel-su busctl call  net.connman /net/connman/technology/gps net.connman.Technology SetProperty sv "Powered" b false
 busctl call  net.connman /net/connman/technology/gps net.connman.Technology GetProperties
a{sv} 5 "Name" s "Gps" "Type" s "gps" "Powered" b false "Connected" b false "Tethering" b false

Haven’t tested whether that does anything though.

1 Like

State of location config is stored in /etc/location/location.conf. I’ld probably watch that file for changes (e.g. with inotifywait) and toggle gpscon depending on the content of that file. A few lines of shell skript started from a user service should be sufficient.

1 Like