So many things require a context I'm just in the habit at this point of passing the Context around everywhere. You can get in trouble if you try to preserve a reference to a context past it's lifetime though.
On Dec 15, 10:59 am, Mariano Kamp <mariano.k...@gmail.com> wrote: > Hi, > > I am downloading web pages off of the internet and some of those sites > want to format their content for the actual user agent used. > > I want to use the user agent that is later on used to display the stuff I > donwnload. > > I can ask WebView.getWebSettings().getUserAgentString() to get the user > agent, but this doesn't work all that well for my app as I need to > instantiate a WebView first even though I don't need. Furthermore to do that > I need to have a UI context, which I don't as this part of the app doesn't > have a UI. > > Is there another way to get to the User Agent? > > I found in WebSettings: > > // User agent strings. > private static final String DESKTOP_USERAGENT = > "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en)" > + " AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2" > + " Safari/525.20.1"; > private static final String IPHONE_USERAGENT = > "Mozilla/5.0 (iPhone; U; CPU iPhone 2_1 like Mac OS X; en)" > + " AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2" > + " Mobile/5F136 Safari/525.20.1"; > > But of course, this is private. Any other idea? > > Cheers, > Mariano -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en