Learning Android Development
Setting UserAgent for Android Network
Helping your server identify your Android client
Android tutorials normally won’t teach you this. But if you do professional Android development where you interact with the backend service that is served by your teammate, you’ll need to set up your UserAgent when you are calling for the service.
In computing, a user agent is software (a software agent) that is acting on behalf of a user, such as a web browser that “retrieves, renders and facilitates end user interaction with Web content” — Wikipedia
If you don’t set it up, OkHttp (the library for android networking) will still provide a simple user-agent. It only contains the version of okHttp used as seen below.
This is of little use if your service would also like to know other things like what version of App is sending the request, what Android SDK, package name, etc (in case the server is serving more than one app).
By providing sufficient information, the UserAgent is really useful in many ways. E.g. if an issue happens on a particular version of the…