WifiAdmin.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:cordova-plugin-wifi 作者:
private PluginResult executeEnableWifi(JSONArray inputs, CallbackContext callbackContext) {
    Log.w(LOGTAG, "executeEnableWifi");

Context context = cordova.getActivity().getApplicationContext();
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);

boolean toEnable = true;
try {
    toEnable = inputs.getBoolean( 0 );
} catch (JSONException e) {
      Log.w(LOGTAG, String.format("Got JSON Exception: %s", e.getMessage()));
      return new PluginResult(Status.JSON_EXCEPTION);
}

wifiManager.setWifiEnabled( toEnable );
callbackContext.success();

    return null;
  }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号