Wifi scan results broadcast receiver not working?

Well, it's not that easy ;-) there are couple of things missing... here is an example of a wifi scan - the original source code is located here androidsnippets.com/scan-for-wireless-ne....

Well, it's not that easy ;-) there are couple of things missing... here is an example of a wifi scan - the original source code is located here androidsnippets.com/scan-for-wireless-ne... package com.android. Wifitester; import java.util. List; import android.app.

Activity; import android.content. BroadcastReceiver; import android.content. Context; import android.content.

Intent; import android.content. IntentFilter; import android.net.wifi" rel="nofollow">android.net.wifi. ScanResult; import android.net.wifi" rel="nofollow">android.net.wifi.

WifiManager; import android.os. Bundle; import android.view. Menu; import android.view.

MenuItem; import android.widget. TextView; public class WifiTester extends Activity { TextView mainText; WifiManager mainWifi; WifiReceiver receiverWifi; List wifiList; StringBuilder sb = new StringBuilder(); public void onCreate(Bundle savedInstanceState) { super. OnCreate(savedInstanceState); setContentView(R.layout.

Main); mainText = (TextView) findViewById(URL4. MainText); mainWifi = (WifiManager) getSystemService(Context. WIFI_SERVICE); receiverWifi = new WifiReceiver(); registerReceiver(receiverWifi, new IntentFilter(WifiManager. SCAN_RESULTS_AVAILABLE_ACTION)); mainWifi.startScan(); mainText.

SetText("\\nStarting Scan...\\n"); } public boolean onCreateOptionsMenu(Menu menu) { menu. Add(0, 0, 0, "Refresh"); return super. OnCreateOptionsMenu(menu); } public boolean onMenuItemSelected(int featureId, MenuItem item) { mainWifi.startScan(); mainText.

SetText("Starting Scan"); return super. OnMenuItemSelected(featureId, item); } protected void onPause() { unregisterReceiver(receiverWifi); super.onPause(); } protected void onResume() { registerReceiver(receiverWifi, new IntentFilter(WifiManager. SCAN_RESULTS_AVAILABLE_ACTION)); super.onResume(); } class WifiReceiver extends BroadcastReceiver { public void onReceive(Context c, Intent intent) { sb = new StringBuilder(); wifiList = mainWifi.getScanResults(); for(int I = 0; I Append((wifiList.

Get(i)).toString()); sb. Append("\\n"); } mainText. SetText(sb); } } }.

I got the above code working with the following in my manifest: Notice both the android:enabled="true" attribute in the receiver element, and the full path to the class that should be executed when the message is received as opposed to ". Classname". All the best and thanks for a starting point, Max.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions