This is seriously easy to do, and nobody needs to get hurt if you're careful about what port you use, are willing to try a few alternatives, and shut it down when you're done.
You don't even have to implement HTTP -- all you have to do is LISTEN, ACCEPT, read the request a line at a time up to the UA string, and then close. Do it in an async task, and save away the result. Still, I have to wonder what you're doing at a higher level. Actually trying to drive logic from the UA string is fraught with peril, and I have to wonder if maybe you shouldn't seek to do things in a way that it doesn't matter of the UA string is modified. If it's just for information purposes -- it's a lot easier to display this information from a simple web application. There are a number of them out there that do this for diagnostic purposes, or it's really easy to write your own. On Feb 21, 8:33 am, Mark Murphy <[email protected]> wrote: > dan raaka wrote: > > I wanted to the browser ua string. > > i am writing an app to programmatically verify the uastring to see if > > the oem has changed it from the standard android ua string. > > Step #1: Write a rudimentary HTTP server in Android. > > Step #2: Point the browser to your HTTP server's port > (e.g.,http://127.0.0.1:8080) > > Step #3: Read the User-Agent header > > Step #4: Shut your HTTP server down before somebody gets hurt > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 1.0 In Print! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

