本文整理匯總了Java中android.net.wifi.SupplicantState.isValidState方法的典型用法代碼示例。如果您正苦於以下問題:Java SupplicantState.isValidState方法的具體用法?Java SupplicantState.isValidState怎麽用?Java SupplicantState.isValidState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.net.wifi.SupplicantState
的用法示例。
在下文中一共展示了SupplicantState.isValidState方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onReceive
import android.net.wifi.SupplicantState; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
_logger.Debug("_wifiStateReceiver onReceive");
String action = intent.getAction();
if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
SupplicantState state = intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE);
if ((SupplicantState.isValidState(state) && state == SupplicantState.COMPLETED)) {
_logger.Debug("Successfully connected WIFI completed!");
if (_sendDataController.GetSelectedServerIp() == null) {
SearchForServer();
}
}
} else {
_logger.Warn(String.format("Action is %s", action));
}
}
示例2: onReceive
import android.net.wifi.SupplicantState; //導入方法依賴的package包/類
@Override
public void onReceive(final Context context, Intent intent) {
String action = intent.getAction();
if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
SupplicantState state = intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE);
if (!(SupplicantState.isValidState(state) && state == SupplicantState.COMPLETED)) {
Logger.getInstance().Warning(TAG, "Not yet a valid connection!");
return;
}
}
new Handler().postDelayed(() -> {
BroadcastController broadcastController = new BroadcastController(context);
if (new NetworkController(context).IsHomeNetwork(SettingsController.getInstance().GetHomeSsid())) {
if (!new AndroidSystemController(context).IsServiceRunning(MainService.class)) {
Intent startMainServiceIntent = new Intent(context, MainService.class);
startMainServiceIntent.putExtra(MainService.MainServiceOnStartCommandBundle, true);
context.startService(startMainServiceIntent);
} else {
broadcastController.SendSimpleBroadcast(MainService.MainServiceStartDownloadAllBroadcast);
}
broadcastController.SendSimpleBroadcast(NetworkController.WIFIReceiverInHomeNetworkBroadcast);
} else {
TemperatureService.getInstance().CloseNotification();
WirelessSocketService.getInstance().CloseNotification();
WirelessSwitchService.getInstance().CloseNotification();
broadcastController.SendSimpleBroadcast(NetworkController.WIFIReceiverNoHomeNetworkBroadcast);
}
}, 10 * 1000);
}
示例3: onReceive
import android.net.wifi.SupplicantState; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION .equals(action)) {
SupplicantState state = intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE);
if (SupplicantState.isValidState(state)
&& state == SupplicantState.COMPLETED) {
mIsConnected = checkConnectedToDesiredWifi();
if(mCallback != null){
if(mIsConnected){
mCallback.onSuccess();
}
else{
mCallback.onFailed();
}
}
}
else if(SupplicantState.isValidState(state)
&& state == SupplicantState.DISCONNECTED){
Log.d(mTAG, "Wifi STA is disconnected");
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
wifiManager.reconnect();
}
}
}