I'd like to ping clients of my mobile AP. This way I want to see if the client is really connected to my hotspot, since /proc/net/arp only refreshes, when I shut down my hotspot.
This is my AsyncTask:
protected Boolean doInBackground(Object... arg0) {
// TODO Auto-generated method stub
try {
InetAddress ip = (InetAddress) arg0[0];
this.context = (Context) arg0[1];
return connected = ip.isReachable(5000);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
@Override
protected void onPostExecute(Boolean result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
android.widget.Toast.makeText(this.context, String.valueOf(this.connected), android.widget.Toast.LENGTH_SHORT).show();
}
Is there a way to ping a client when your device is not rooted?