ev-map / EVMap

Android app to find electric vehicle charging stations - compatible with community databases such as GoingElectric.de and OpenChargeMap.org.
https://ev-map.app/
MIT License
202 stars 55 forks source link

Android Auto: Allow to search for chargers along the route, near the destination, or along the driving direction #143

Open johan12345 opened 3 years ago

johan12345 commented 3 years ago

would require access to the currently running navigation route, as requested in https://issuetracker.google.com/issues/204692004

johan12345 commented 2 years ago

A workaround that I have thought about: We might be able use the user's current location and speed to find out that the user is traveling on a highway/motorway in a certain direction, and then propose to show upcoming chargers along this road. This of course only works well if the user intends to stay on this road.

johan12345 commented 2 years ago

Another simpler workaround: Allow the user to find chargers within a bounding box along their driving direction.

johan12345 commented 2 years ago

And another idea: With notification access, we may be able to find out the user's current destination from the persistent notification from Google Maps. However it may be ambiguous (e.g. the notification may only contain the street address but not the postcode/city).

johan12345 commented 2 years ago

With #244, search for chargers along the current driving direction is now implemented.

As mentioned above, reliably implementing a search along the route or near the destination needs access to the current navigation route, which is not yet implemented in Android Auto.

twischer commented 2 years ago

Hello @johan12345,

I am also interested in such a feature and willing to implement parts. As far as I can see https://issuetracker.google.com/issues/204692004 is marked as fixed. Was the only change introduced with this fix the addCompassListener() used by https://github.com/johan12345/EVMap/pull/244 ? Does it mean we would still not be able to identify chargers near the route Google Maps is currently navigating to?

I would even like to extend this feature to show the diversion in minutes to reach a certain charger (if possible via the Google API).

johan12345 commented 2 years ago

Hm, I am actually not sure why that issue has been marked as fixed - I cannot see any relevant updates in the changelog. I have just added a comment in the issue tracker to ask whether this was intentional.

twischer commented 1 year ago

Hello @johan12345,

looks like there is no progress from Google. I have two alternatives in mind:

  1. Allow the users to enter there own Google API key. So the Distance Matrix API can be used to sort the chargers by the distance to the current location and the minimal detour in minutes between current location and the destination. As far as I understand with a free API key 40,000 distances/month (200$/month / 0.005$) can be calculated 1
  2. Export available charging stations matching the filters in the EVMap app as Google Maps favorites. The favorites can be seen in the Google Maps app and in https://www.google.de/maps. Whenever the status of a charger changes add or remove it to the Google Maps favorites

What do you think about such approaches? Do you see already any issues with such solutions?

johan12345 commented 1 year ago

Allow the users to enter there own Google API key. So the Distance Matrix API can be used to sort the chargers by the distance to the current location and the minimal detour in minutes between current location and the destination. As far as I understand with a free API key 40,000 distances/month (200$/month / 0.005$) can be calculated 1

Yes, that would probably be the API to use. However there would still need to be a way for EVMap to know what your current route / destination is (as discussed above). And adding your own API key is quite complex for non-technical users, but yes, looking at the size of the current user base it is probably necessary.

Export available charging stations matching the filters in the EVMap app as Google Maps favorites. The favorites can be seen in the Google Maps app and in https://www.google.de/maps. Whenever the status of a charger changes add or remove it to the Google Maps favorites

I think there is no way to dynamically update Google Maps favorites through an API...

twischer commented 1 year ago

there would still need to be a way for EVMap to know what your current route / destination is

For me it would be fine to enter the destination manually (like searching for chargers at a certain location). But it could also be extended by a feature of getting the destination from the current appointment in the Google calendar (like Google Maps does it)

I think there is no way to dynamically update Google Maps favorites through an API

So far I also did only found https://developers.google.com/maps/documentation/android-sdk/marker which seems not to fit for our needs because it cannot be combined with showing a route (as far as I understand),

ntruchsess commented 7 months ago

I use OSMAnd for navigation and allready have contributed to the project. Currently OSMAnd doesn't provide an api to access the current route, but there is a PR that aims to implement that: https://github.com/osmandapp/OsmAnd/pull/9304 While this PR is now open for quite some time the OSMAnd-developers initially intended to merge it, but then there were conflicts and the initial contributor apparently is no longer interested to solve those.. @johan12345 : if you are interested I'll pick up this PR, solve the conflicts and resubmit it mentioning that EVMap as would be the first consumer.

johan12345 commented 7 months ago

@ntruchsess That sounds interesting! Does that API also work if the OsmAnd navigation is running on Android Auto (and not currently in the foreground on the phone)? Probably, right?

A common API for different navigation apps to provide this data would of course be nicer, but at least it's a first step :)

I can't promise though that I can implement that feature quickly on the EVMap side, I haven't had that much time recently and also still want to finally finish up #290 ...

324 will also need some refactoring of the map screen on Android Auto (but in turn give us more flexibility, e.g. the route could be displayed on the map). So it probably makes sense to implement it (at least the Android Auto part of it) after that is done.