Android navigation service implementation - android

I'm creating a gps/mapping app for orienteering. I'll be making use of the Google Maps Api v2 (For Android) and overlaying routes and waypoints and all of that kind of stuff. I really like how the Google 'Navigation' app that comes with the Google 'Maps' app keeps track of the navigation & gps location from what looks like a service. I.e. you can see that it still has a GPS lock and it displays waypoint information in the notification bar even when the activity is not in the foreground. Also, when you re-open the app whilst it's still in navigation mode, it opens up to and displays your position and navigation information straight away as if the app hadn't closed at all. Could anyone provide advice as to how to implement something similar or point me in the direction of open source projects that use a ‘navigation service’ type approach as outlined above.
Many thanks.

AFAIK the Google Maps API for Android doesn't support the access to Routing - Information.
It is more related in the visualization of points on the map and geo - location through GPS.
So this would be the GUI - part.
When you want to have nice notifications about the current position in a route for setting up a Navig - App you would have to use the Directions API.
You could implement your functionality within a (remote) service which is started when your app is started and keeps on running until canceled.
It's more like writing two apps, actually: One to have a nice GUI quick and one for the functionalities needed to be running in the background.
This service still could provide additional informations to your app using the AIDL / Parcelable - Objects.
All HTTP - Requests to Directions API should be running in threads, of course, to avoid io - blocking, and another separate thread handles the notifications.

Related

Flutter app stay running while in background

I have an app I have building that is giving navigation from a location to a location. Contstantly tracking where the user is using GPS data in order to give good Directional information. Currently if a user switches from our app to another app or goes to the Android home screen, after one minute Android turns off our app for performance reasons.
I have tried using an Isolate but like flutter this gets shutdown. Next step were to use a kotlin service to handle background things but i wanted to check if anyone had done this in dart yet?
Also this is not an app that will be in the play store or on public devices. It is going on special devices that we control and are less worried about memory usage as this will be the main app ran on them.
as mentioned above in the comment by #galloper background_fetch is the thing you need, it has a method called BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask); where backgroundFetchHeadlessTask is a function that will keep running even when the app is close, i used this in my app to stream location info to server.

Return to "my app" when navigation finish

In Android, using Google Maps API v2 Intent, is it possible return to my app after the user arrives at his destination using navigation?
Thanks!
Not sure why you would want to do that. But one possible solution could be:
Get location updates in background using some Service.
Use GeoFencing.
As soon as you detect you are at your destination using GeoFencing, either a) You launch your Activity from the Service (which is not a good UX at all as the user will be disrupted from his Maps experience), or b) You show a notification to the user and user can launch your app from that.
Beware that starting Android O, the frequency of location updates you get while on background is very limited. One possible solution would be to know how long it will take the user to reach the destination and plan your location updates accordingly.

How to get turn by turn details real-time to my app

I'm doing a arduino project for my end year project.I'm making a smart glove for bike riders which can notify phone calls,Health tracking,Geo tracking and Navigation.
I want to know is there any method I can get details about turn by turn navigation into my app.
i.e :if google navigation said "turn left" get that details and display in my app.
P.S:There is a product called Sneakair by easy jet shoes that auto vibrate when turn is arrived.
If this is impossible tell me another idea that can embed to my project it would appreciated.
You should be aware about certain restrictions regarding Google Maps APIs.
The Terms of service, paragraph 10.4 c says:
No navigation. You will not use the Service or Content for or in connection with (a) real-time navigation or route guidance; or (b) automatic or autonomous vehicle control.
https://developers.google.com/maps/terms#10-license-restrictions
So, you cannot use Maps API for real-time applications.

What android broadcasts are sent by gmaps while navigating?

I am developing an android application which captures the location of every turn the user made while navigating from a source to a destination. My application would launch gmaps automatically and will run in the background, until the user has completed navigation. I would like to know what broadcasts gmaps would be sending to the android system during navigation?
For example, during navigation we would be getting voice instructions such as "in 100ft turn left etc". This happens with the help of some broadcasts. I would like to utilize them.
Also, please guide me if what my thinking is wrong and is there any other easy way to find out the turns. Kindly, note that my application requires to know about the location of turns at least a 100ft before the actual turn but not after the turn.
Please note that I am not interested in using gmaps API as they have a service charge beyond certain threshold and I am trying to build a free application.
Thanks.

How to retrieve current Google map destination on Android?

I am building an Android app that needs to run in the background and act when user uses Google map. Specifically, when use sets a a direction and navigation starts, I want to retrieve the target address and act on it.
The question: is it possible for third party app to retrieve the target address?
I was thinking that this can be done by retrieving the list of markers as discussed here.
Is this the right approach?
An secondary issue will be if there is way to have an intent that can wake up my app when the navigation starts.
I reckon quite simply the intents launched by Google Maps are not exposed to other applications (or in other words, when you create a nagivation task in Google Maps, there's no actual callback launched that can be hooked to by another app.)
However, assuming the navigation task will create a notification, you could perhaps abuse that notification and it's content to recognize navigation is currently running.
Though more importantly, what's the functionality you aim at with this? Likely you'd be better off implementing the Maps-API in your own app and handling everything from there.

Categories

Resources