Code example for WifiInfo

Methods: getSSID

0
	@Override 
	public void onReceive(Context context, Intent arg1) {
		WifiManager wifi = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
		WifiInfo info = wifi.getConnectionInfo();
		if(info != null) { 
			String ssid = info.getSSID();
			if((ssid != null) && ssid.contains("Eye-Fi")) {
				Log.i(TAG, "Broadcast received for essid " + ssid + "; waiting for card");
				startup(context);
				return; 
			} 
		} 
		Log.i(TAG, "Broadcast received; ignoring");
	} 
 
	private void startup(Context context) {
		PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
		PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, 
				"Fe-Fi WifiWatcher"); 
		wakeLock.acquire(120000);
		context.startService(new Intent(context, EyefiReceiverService.class));