當前位置: 首頁>>代碼示例>>Java>>正文


Java SupplicantState.isValidState方法代碼示例

本文整理匯總了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));
    }
}
 
開發者ID:GuepardoApps,項目名稱:PasswordSafe-AndroidClient,代碼行數:19,代碼來源:AccountListViewController.java

示例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);
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:31,代碼來源:WIFIReceiver.java

示例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();
        }
    }
}
 
開發者ID:dmtan90,項目名稱:Sense-Hub-Android-Things,代碼行數:28,代碼來源:WifiSta.java


注:本文中的android.net.wifi.SupplicantState.isValidState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。