views:

43

answers:

1

When building desktop or web apps, its easy to add fake hosts file entries so apps will connect to dev servers instead of production ones - is something similar possible for Android apps?

+2  A: 

You can't edit the /etc/hosts file on most Android devices, since you normally don't have root access.

A better option is to just build a preference into your application that allows you to specify which server your application can use when establishing it's connection.

Trevor Johns
Is it possible to check if an app is being debugged and switch hostnames that way?
Eno
Yes. See android.os.Debug.isDebuggerConnected(): http://developer.android.com/reference/android/os/Debug.html#isDebuggerConnected()
Trevor Johns