ud_an ud_an - 1 year ago 88
Android Question

android scan for wifi network

i am trying out this code for scanning wifi networks but getting null pointer exception not sure what problem i registered all permission in manifest.

IntentFilter i = new IntentFilter();

registerReceiver(new BroadcastReceiver(){


public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.i(TAG, "opening wifimanager");
WifiManager mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);



Answer Source

Are you testing this on a device or on a stimulator. And have you added the following permissions on your Manifest

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download