Android launching navigation within app - android

I am developing an Android application for children going to a bus stop. I have the navigation button in my app. When pressed, the GPS gets on and I get the latitude and longitude of the bus stop. An intent is fired, launching Google Navigation app with the values of the child's current location and the lat,long values of the bus stop. This launches Google Navigation app showing the route to the bus stop making my app go in background.
The user(child) has to exit navigation in order to view the bus stops in the app.
So what I am planning to do is make an in app navigation by launching navigation window half of the screen. How do I achieve this?

Have a look in here:
https://developers.google.com/maps/documentation/android-api/
This is official Google API for Maps. Using just several import statements and some code you can utilise maps in your app. Demos and code samples are under the link. Good luck :)

Related

Android Mapbox Navigation - Sometimes does not initialize and other times crashes when the User is on the Same location

I have a React Native Project that calls and Android Activity that contains the Mapbox Navigation SDK Embbeded Navigation (https://docs.mapbox.com/android/navigation/examples/embedded-navigation/). Within React Native, I am already using lots of resources like consuming from Graph QL through Apollo Client. I have also make sure to turn on GPS and check for Internet Connection before navigating to the Android Activity. Issues.
1) When I generate a Release and run it on my Android, the first time the Mapbox Navigation is launched, the Pointer would stay static, the Map gets rendered but the Navigation Instruction UI does not start. It is as the Fetch that gets the route never proceeds to start the Navigation.
Another issue that I have from time to time, is that when I set the Driving Mode to Traffic like going by Car, I start the Navigation Activity but if stay static on the same point for too much time, the app would crash, it is as if the Some Lister is actually waiting for my Location to change in order to proceed with the Navigation.
Thanks for all the suggestions.
Edit:
For the first issue, I was able to move the following out of the Create() of the Activity, I was initializing a Real Time Library called PubNub for initializing the Map.
CameraPosition initialPosition = new CameraPosition.Builder()
.target(new LatLng(ORIGIN.latitude(), ORIGIN.longitude()))
.zoom(INITIAL_ZOOM)
.build();
navigationView.initialize(this, initialPosition);
Issue 2, stil persist. The current issue is that the Navigation Activity Crashes if the User does not move within the Naviga enter image description here

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.

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.

Android navigation service implementation

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.

Categories

Resources