How to launch a car navigation to location from the app - android

You might find my question silly, but I can't find anything about it. I don't even know how to call it to get the tutorial I need.
I want simply my application after clicking a button to start for example Waze and pass on the address that the user can navigate to it.
If you could just direct me what should I look for it will be great.

If you want to launch the Waze app specifically, you can use the URL scheme at waze.com/about/dev to launch the app. I don't know of any Intent protocol or URL scheme that's shared by any and all navigation apps.

Related

Should I open an url in WebView inside app or in browser?

I was wondering if there is a best practice in Android about WebView/Browsers. I want to open an url in my app to show a web page but I do not have anything to retrieve from that page so I do not need to show it in a webview inside my app. Should I show that page in a browser or in a webview ?
If you should open an URL in WebView or Browser that totally depends upon your requirements. Still I am adding some points that you can consider:
Browser:
If you have some data like Privacy Policy of your organization, that just for user information. You do not require any inputs from user.
WebView:
If you want to,
Customize content of URL
Get some input from User
Send some information to Server
Thank You!
Quick Answer:
From your context, it looks going the Browser way is good enough.
Details:
When you don't have user inputs to process and it is not part of the user-flow in your app, go about showing it in the Browser. It's easier that way, because you don't have to manage anything explicitly.
When you have something to process or that this window is some part of your in-app flow, you should go the WebView way. It gives you the power to manage things and you really need to code of situations like user pressing "back button", and the like. I mean, you're the owner of the life-cycle management of the WebView and see how it seamlessly fits in your user flow while (s)he is at it.

How to pass data to the website opened from android app

I Want to open a site from an app and pass data from that app to that website.Like if we open google page from my app,the searching word should be passed from the app which is nothing but auto-filling.Can anybody please suggest
Thanks,in advance
Use Intent to pass data from one app to an another app.
Go through this http://developer.android.com/reference/android/content/Intent.html link for more info.
In your case, i guess implicit intents would be a better choice.

Set default browser from within app

I'm developing an app that we will put on Android tablets on be used by employees in the field. We want to lock down internet access as much as possible to minimize data usage (so that the employees can't go streaming Netflix movies or something and driving up our data usage). As part of that effort, I'd like to have http(s)?:// links open up in a custom activity I made. Now, I can easily do that by registering the activity with an intent filter on the http/https schemas, but I'd prefer not to have the user have to choose between browsers when opening a link, and I don't want my activity to become the default activity for every link (there may be situations in which the user should be using the Android browser).
Is there a way to set up my activity as the http handler...but only for links launched from my app?
Is there a way to set up my activity as the http handler...but only for links launched from my app?
If the links are from your app, just use startActivity() with an Intent identifying your activity, rather than some generic Intent like ACTION_VIEW.
If your issue is that you are displaying the Web content in a WebView and links clicked there lead to the browser, use setWebViewClient() along with a WebViewClient implementation that handles shouldOverrideUrlLoading().

Passing data from Android Browser to external app

This is what I need to do:
I have an app running in the background. Now when the user is browsing and comes across an 'interesting' URL, he can make a gesture and send the URL to the external app. The app then processes it.
I can think of two way of doing this(though I am not sure if either is possible)
1. Program something like a hook that senses the particular gesture or key press and sends the URL to the app
Write something like an add on to the browser.
My question is, is any of this possible. If yes, could you give me a few hints so that I can go ahead. If not, then is there any other way to do it?
Thanks,
Sandip
Short answer : You can't use the android browser like this.
Long answer : The android browser is an application. The only way you can interact with it is to call it with an argument (a URL). And... that's all. You can't write an extension to the browser like you can do in Chrome.
If you want to control the browser, use a webview, but even in that case, you won't have the ability to detect gesture.
What you're trying to do is not possible.
Take a look at WebViewClient.shouldOverrideUrlLoading. It should allow you to be notified when a new URL is loaded.
http://developer.android.com/reference/android/webkit/WebViewClient.html#shouldOverrideUrlLoading%28android.webkit.WebView,%20java.lang.String%29

Find out which browsers are installed?

I'm looking for a way to find out which browsers are installed on the Android Smartphone and their package names.
Why do I need it?
Well basically, my App reacts on certain URLs, i.e. http://bit.ly, so when the click such an he will get an choice in which App to open it. So far everything is working as intended.
If the user sets up this app as default for this kind of links, it will always open in this one without further asking the user. So far so good too. But by doing this, he will be completely unable to open this links in his browser.
So I need a way to send this intent directly to the browser, but to do so I have to know which app the user has set to be default for http/https scheme for example (as user can change it if there is more than 1 browser installed).
Sending the intend with
intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
should't be a problem I think. The problem is, I can't send a standard intent für URLs, because my App would catch it again if set as default by the user.
should't be a problem I think
Hardwiring in the package and class names of code that is not yours is always a problem.
So I need a way to send this intent directly to the browser, but to do so I have to know which app the user
has set to be default for http/https scheme for example (as user can change it if there is more than 1
browser installed).
Use PackageManager and queryIntentActivityOptions() to filter your activity out and get a list of other activities that the user can choose from.

Categories

Resources