visibility="public"
>
</field>
+<field name="ACTION_WIFI_BUTTON"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.intent.action.WIFI_BUTTON""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="CATEGORY_ALTERNATIVE"
type="java.lang.String"
transient="false"
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
+ public static final String ACTION_WIFI_BUTTON = "android.intent.action.WIFI_BUTTON";
+
// *** NOTE: @todo(*) The following really should go into a more domain-specific
// location; they are not general-purpose actions.
//Initiate a read of Wifi Ap configuration
Message.obtain(mWifiHandler, MESSAGE_READ_WIFI_AP_CONFIG).sendToTarget();
+
+ mContext.registerReceiver(
+ new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ processWifiButton();
+ }
+ },
+ new IntentFilter(Intent.ACTION_WIFI_BUTTON));
}
/**
return (wifiSavedState == 1);
}
+ private void processWifiButton( ) {
+ if (isAirplaneModeOn() != true) {
+ setWifiEnabled(getWifiEnabledState() == WIFI_STATE_DISABLED);
+ }
+ }
+
private boolean getPersistedWifiEnabled() {
final ContentResolver cr = mContext.getContentResolver();
try {