The problem what im facing now is that my app wont connect to internet, i usually run my app on Bluestacks app player and one AVD device and i have give the following permissions
<uses-permission android:name="android.permission.INTERNET" />
Points to be noted:
1)I can access internet through emulator browser.
2)My app canaccess internet if i run it on real device.
Code Sample:
Runtime runtime = Runtime.getRuntime();
try {
Process mIpAddrProcess = runtime.exec("/system/bin/ping -w 2 8.8.8.8");
mExitValue = mIpAddrProcess.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(mIpAddrProcess.getInputStream()));
int i;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((i = reader.read(buffer)) > 0)
output.append(buffer, 0, i);
reader.close();
String str = output.toString();
if (mExitValue == 0)
{
Toast.makeText(getApplicationContext(),"Connection ok"+ str, Toast.LENGTH_SHORT).show();
} else
{
Toast.makeText(getApplicationContext(), "Please Check Your Internet Connection"+str, Toast.LENGTH_SHORT).show();
//new Description().execute();
}
}
Help me please , Thank you