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.
Related
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.
I've just read about the Android APIs called Assist and VoiceInteraction.
What I'm trying to achieve is an app like NowOnTap. For this, I need an access to the screen's content before the user long presses the home button.
First, I tried using a normal activity with the android.intent.action.ASSIST action.
Digging more into this, I found out that in order to access a screenshot before opening the apps, I need to implement VoiceInteractionSession and its methods onCreateContentView and onHandleScreenshot.
I wasn't able to create UI by using onCreateContentView and, according to my logs, it doesn't even gets called. Anyone with experience using this APIs?
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.
The iOS OS provides this back button on the top of an app that was opened via custom URL schemes. This button generally displays the name of the app that launched the custom URL scheme. This could be seen in the screenshot, "Return to Search". Search is the app that opened the app in foreground now.
I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.
NOTE - I know iOS do not have a back button, and hence this was developed. But displaying the app name, makes it explicit that my app was opened via URL intent by this app. It provides higher visibility to the users.
I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.
No, insofar as you have no way of knowing who started your activity.
The is no way of doing it automatically, but:
Android API lvl 22 introduced a new method getReferrer() to return information about who launched this activity.
By default, it will return a android-app: referrer URI.
For instance, Chrome beta will use android-app//:com.chrome.beta as referrer when launching an app.
You could therefore use this value (it might not be 100% trusted) and query the package manager to get the application label.
You can collect some data that manages user experience, but only in your own environment. For example N apps that interact with each other. If you think closely you will see that knowing who wakes your app up doesn't make sense since the caller can use a broadcast, for instance.
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.