Saturday, February 20, 2010

[android-developers] Re: user agent of the device ..

If you're using a WebView, the answer is yes.

WebView webview = ...;
WebSettings settings = webview.getSettings();
String uastring = settings.getUserAgentString();

I don't know of a way to ask the Browser application itself -- but if
you're doing this level of stuff, you may be wanting more control
anyway, and want to use a WebView.

What would you do with this information in an app?

I guess you could run a little web server in your app, direct the
browser to it, pick up the UA string, and redirect to somewhere else.
Bleh. A whole lot of hackery for something that hardly ever changes.

On Feb 19, 11:21 pm, Dan Raaka <danra...@gmail.com> wrote:
> is there a way to get the User Agent of the Browser on the android
> device pro grammatically from within an app ?
>
> -Dan

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate