New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Add handling of phone gps data #2304
Conversation
Looks good but i suggest to add some description for the "Overwrite GPS" setting to the README file. |
|
||
function onGpsOverwriteChange(newValue) { | ||
if (newValue) { | ||
Bangle.setGPSPower(false, 'android'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is needed... The way setGPSPower
works this would only ever turn off the GPS if it had been turned on with Bangle.setGPSPower(true, 'android');
- if any other app requested it, it'd stay turned on
This looks great, thanks! And I really appreciate you adding the setting for this - as until we get this all merged and in the app store we don't want users finding their GPS stops working ;) Just a thought, but since when the setting is changed we end up restarting and reloading the Do you see a problem with doing that? If not I'm happy to merge this and make the change here |
@LukasEdl just checking on what I said above - is it ok if I do that? |
Sorry for the late response, i was away the last few days. If you want to do that, please go ahead. |
In the Gadgedbridge PR, i add the possibility to use the gps data of the phone.
With this PR, the android app gets extended, so that it can handle the communication with the gadegtbridge part.
To enable to do that i changed the following.
I added a handler for a "gps" and a "is_gps_active" GB message.
I added a logic to overwrite the "setGPSPower" method and the "isGPSOn" method. This is needed so that, if the phone gps data is being used, the gps of the banglejs device is turned off.
I added a setting to enable the overwrite. This must be set or other wise the messages from the phone will be ignored.
The received gps data will be provided under the "gps" event, like if you would use the normal gps chip of the banglejs. However if the phone data is being used, the event "GPS-raw" will not be fired. (I don't know how to convert the gps data to raw data, if anyone can and want to do it, feel free to add this)
The phone gps also dose not provide the amount of satelites and the course. Those two values will be set to the NaN value. Also the fix value will be set to 1 ( If someone knows how to set the correct "fix" value, feel free to add it)
GPS data, which was provided through the phone will have an extra flag called "externalSource".