Scrape Navigation info from Google Maps notifications, and add Navigation handling to Bangle.js #3136
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
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
weather
wontfix
Zepp OS
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Freeyourgadget/Gadgetbridge#3136
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "gfwilliams/Gadgetbridge:navigation-google-maps-notify"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
It looks like navigation code based on #2387 has just gone into the master branch, so it'd be great to get this working with Google Maps too.
I've been using this for the last few days and it seems pretty stable - we have to figure out the actions by matching the image Google Maps displays on the notification, but I do a 'fuzzy' match - it's pretty quick and should put up with a few device-specific differences.
@ -276,2 +279,4 @@
if (mediaIgnoresAppList && handleMediaSessionNotification(sbn)) return;
/* Check for navigation notifications and ignore if we're handling them */
if (googleMapsNotificationHandler.handle(getApplicationContext(), sbn)) return;
I think this should be toggleable - either by being after the
shouldIgnoreSource
so it can be whitelisted/blacklisted, or by using the toggle from #3135, which wasn't merged yet. If this is merged before #3135 I can update this logic to use the toggle.Yes, good point. I've just moved it after the shouldIgnoreSource check - that's nice and easy and makes sense that you should be able to use the existing app ignore list to stop notifications being parsed.
But yes, when #3135 gets merged we could make the call dependent on that too.
@ -0,0 +313,4 @@
}
public boolean handle(Context context, StatusBarNotification sbn) {
if (sbn.getPackageName().equals("com.google.android.apps.maps")) {
Small nitpick (non-blocker): can we flip this if to reduce the nesting?
I think I've also seen getPackageName being null in the past, so maybe flip it to `"com.google.android.apps.maps".equals(sbn.getPackageName())EDIT: Nevermind - this is not the notificationspec :)
Just updated this - it's been live in the play store for a week or two now and it appears to be working pretty well now. It can easily be disabled by disabling the Google Maps notifications in the normal way in Gadgetbridge.
I gave this a quick test, here's a couple of things I noticed:
We could probably fallback to navLines in case the title is empty / fails to be parsed, since it seems to contain the distance on the 2nd item:
["23 hr 33 min", "110 km", "15:15 ETA"]
Ahh, interesting - I think the 2nd item is the total distance, whereas what we were hoping to report in NavigationSpec was the distance to the next turning?
It seems you were likey right at the point where it wanted you to make a turn, so it wouldn't have given you a number.
When you start and the phone GPS location is still getting more accurate, the values do move around a bit, but I found that in practice you only got updates when the value changes. When driving around it was about once a second, but honestly if you're driving and looking at the countdown of distance to the turning, that's kind of what you want.
On Bangle.js we treat the nav updates slightly different to notifications - but they don't buzz. I don't know if that's something you can tweak - I did have the idea originally you could have a 'onNotificationModified' event that wouldn't buzz but would just silently update the data
Ah - I think you're right, I got the total distance and distance to the next turn mixed up.
This looks good to me. Regarding the frequent updates, I'll check if I can handle them on my side to get this working with Zepp OS devices.
@gfwilliams can you rebase this branch? Looks like there are some conflicts:
79590fc946
to735f27d5bf
No problem - just rebased and squashed commits - hopefully that sorts it :)
Excellent - thanks! I've been using this a lot recently and it's really handy having navigation on your wrist, especially when cycling or walking