[Banglejs] Send phone location data to banglejs, which can be used as gps data #2961
No reviewers
Labels
No Label
device mi band 7
activity post processing
activity/health
Android 12
Android 13
android integrations
architecture
Bangle.js
bug
changes requested
charts
details not provided
developer documentation
device amazfit band 5
device amazfit bip
device amazfit cor
device Casio
device fossil
device garmin
device gtr 2e
device gts 2 mini
device h30
device hplus
device huami
device Huawei
device liveview
device mi band
device mi band 2
device mi band 3
device mi band 4
device mi band 5
device mi band 6
device no.1 f1
device pace
device pebble
device pebble 2
device pinetime infinitime
device request
device sony
device support
device watch 9
device xiaomi
discussion
documentation
duplicate
enhancement
feature request
Gadgetbridge
good first issue
help wanted
i am developing my own app can you help
icebox
intent api
internationalisation
invalid
needs work
network companion app
new device
no feedback
not a bug
notifications
one of the 1000 issues about disconnection
pairing/connecting
potentially fixed / confirm and close
question
research
security
seems abandoned
Solved, waiting for F-Droid release
suggest to close
task
user interface / UX
wear os
weather
wontfix
Zepp OS
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Freeyourgadget/Gadgetbridge#2961
Loading…
Reference in New Issue
No description provided.
Delete Branch "LukasEdl:banglejs-gps-updater"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With this PR, the gadgetbridge app sends the current locationd data, obtained from the gps or network provider, to a connected banglejs device as an "gps" event.
The bangle device can use this data instead of the internal gps data. Therefor saving battery energy, since the gps chip is one of the biggest energy consumers.
Furthermore it enables the banglejs device to use the location data, based on the network with which the phone is currently connected. This would be usefull if there is no gps signal.
Could you use the GBLocationManager? You can then override
onSetGpsLocation
with the logic you have ononLocationChanged
. See how it is used in HuamiSupport.We might need to update it to include network location updates, as right now it only uses GPS.
Also, I think you're missing some way to unregister the location updates - they will keep going after the device is disconnected.
One more note: this will keep the phone awake and continuously send the GPS updates to the watch - is that intended? What is the use-case? - (bear with me - I don't have a lot of context on the Bangle :) )
Just leaving a related thread over at the espruino/Bangle.js forum here.
I didn't know of the GBLocationManager i gonna take look on it. The network location would be quite usefull since it provides an alternative location, if there is no gps signal (which was the case during the development).
For the context, the banglejs is a smarth watch that is complety programmable. It has bluetooh capabilites and together with the gadgetbridge app it has even access to the internet.
My use case of the constant sending of gps data would be, that the banglejs could show different information based on the location of the device. For instance, it could show my current workout routine when i am at the gym, or the groccery list if i am in a supermarket.
The banglejs has its own gps chip, however it uses alot of energy and it only provides data based on the gps location. With this implementation it would have also access to the network gps data.
The energy consumption would be increased on the smarthphone, however smarthphons tend to have bigger batteries and are charged more often (at least that is in my case).
To improve the energy efficenty, we could maybe use an configurable interval, so that the gps is not always on.
Hi - this looks good - but as @joserebelo mentioned I'd be a bit concerned that this would permanently keep the phone's GPS on, and would drain the phone battery pretty quick.
Maybe you could add a line to
handleUartRxJSON
ate978cb7aa1/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java (L436)
that will detect a message coming in of typegps
and look at apower
field to see if it should turn the phone GPS on or off.The same function to handle on/off could also be called on disconnect to stop the GPS service.
... so then it'd report network location all the time (because that doesn't add to power consumption?) and then on Bangle.js we can have the option to basically override the internal GPS and use the phone's GPS.
Pull request closed