I’m trying to reach internet through my Android app, but I both succeed and fail.
I start the emulator when I build my app, and the app is installed just fine. I can use the browser to access the internet, however, when I try this small code snippet …
InetAddress inet;
try {
inet = InetAddress.getByName("www.google.com");
System.out.println ("IP : " + inet.getHostAddress());
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
… it all fails.
Is there any setting you must do to make the app reach the internet?
You must add this to your manifest file:
to demand authorization to access internet from your app