I have been trying to capture the packets in my android app when connected to Wifi.
I am using a broadcast receiver class.
I have successfully received the broadcast when connected to a wifi network, using this code:
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (null != activeNetwork) {
if(activeNetwork.getType() == ConnectivityManager.TYPE_WIFI){
//wificonnected
return 1;
}
}
I want to capture the packets when network connected. I know everything about wifiInfo and WifiManager class.
I am trying here with jNetPcap library. How to capture those packets? I have no ideas.
Please help me guys...