Java Code Examples for com.gizwits.opensource.appkit.utils.NetUtils#getCurentWifiSSID()
The following examples show how to use
com.gizwits.opensource.appkit.utils.NetUtils#getCurentWifiSSID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GosAirlinkChooseDeviceWorkWiFiActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
@Override protected void onResume() { super.onResume(); try { tvMode.setText(modeList.get(modeNum)); // 预设workSSID && workSSIDPsw workSSID = NetUtils.getCurentWifiSSID(this); String mypass = spf.getString("mypass", ""); if (!TextUtils.isEmpty(workSSID)) { etSSID.setText(workSSID); if (!TextUtils.isEmpty(mypass)) { JSONObject obj = new JSONObject(mypass); if (obj.has(workSSID)) { String pass = obj.getString(workSSID); etPsw.setText(pass); } else { etPsw.setText(""); } } } else { etSSID.setText(NetUtils.getCurentWifiSSID(this)); } // 当没有任何文字的时候设置为明文显示 if (TextUtils.isEmpty(etPsw.getText().toString())) { cbLaws.setChecked(true); etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); cbLaws.setChecked(false); } } catch (JSONException e) { e.printStackTrace(); } }
Example 2
Source File: GosAirlinkChooseDeviceWorkWiFiActivity.java From gokit-android with MIT License | 5 votes |
@Override protected void onResume() { super.onResume(); try { tvMode.setText(modeList.get(modeNum)); // 预设workSSID && workSSIDPsw workSSID = NetUtils.getCurentWifiSSID(this); String mypass = spf.getString("mypass", ""); if (!TextUtils.isEmpty(workSSID)) { etSSID.setText(workSSID); if(!TextUtils.isEmpty(mypass)){ JSONObject obj = new JSONObject(mypass); if (obj.has(workSSID)) { String pass = obj.getString(workSSID); etPsw.setText(pass); }else{ etPsw.setText(""); } } } else { etSSID.setText(NetUtils.getCurentWifiSSID(this)); } // 当没有任何文字的时候设置为明文显示 if (TextUtils.isEmpty(etPsw.getText().toString())) { cbLaws.setChecked(true); etPsw.setInputType(0x90); } else { etPsw.setInputType(0x81); cbLaws.setChecked(false); } } catch (JSONException e) { e.printStackTrace(); } }
Example 3
Source File: GosConfigCountdownActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 4 votes |
private void readyToSoftAP() { // 切换至设备热点 WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID); WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager); manager.connect(softSSID, SoftAP_PSW, cipherType); IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); workSSID = spf.getString("workSSID", ""); workSSIDPsw = spf.getString("workSSIDPsw", ""); final Timer mtimer = new Timer(); mtimer.schedule(new TimerTask() { @Override public void run() { if (progressDialog.isShowing()) { progressDialog.cancel(); mtimer.cancel(); String failText=(String) getText(R.string.configuration_failed); Message msg=new Message(); msg.what=handler_key.FAILED.ordinal(); msg.obj=failText; handler.sendMessage(msg); } else { mtimer.cancel(); } } }, 10 * 1000); isChecked = true; while (isChecked) { String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this); if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) { if (checkNetwork(GosConfigCountdownActivity.this)) { progressDialog.cancel(); isChecked = false; handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null); // handler.sendEmptyMessageDelayed(handler_key.OFFTIME.ordinal(), 2000); } if(broadcase==null){ broadcase = new GosWifiChangeReciver(); registerReceiver(broadcase, filter); } } } }
Example 4
Source File: GosConfigCountdownActivity.java From Gizwits-SmartBuld_Android with MIT License | 4 votes |
private void readyToSoftAP() { // 切换至设备热点 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager); WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID); manager.connect(softSSID, SoftAP_PSW, cipherType); IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); workSSID = spf.getString("workSSID", ""); workSSIDPsw = spf.getString("workSSIDPsw", ""); final Timer mtimer = new Timer(); mtimer.schedule(new TimerTask() { @Override public void run() { if (progressDialog.isShowing()) { progressDialog.cancel(); mtimer.cancel(); handler.sendEmptyMessage(handler_key.FAILED.ordinal()); } else { mtimer.cancel(); } } }, 10 * 1000); isChecked = true; while (isChecked) { String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this); if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) { if (checkNetwork(GosConfigCountdownActivity.this)) { GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null); progressDialog.cancel(); isChecked = false; handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); } registerReceiver(broadcase, filter); } } }
Example 5
Source File: GosConfigCountdownActivity.java From gokit-android with MIT License | 4 votes |
private void readyToSoftAP() { // 切换至设备热点 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID); WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager); manager.connect(softSSID, SoftAP_PSW, cipherType); IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); workSSID = spf.getString("workSSID", ""); workSSIDPsw = spf.getString("workSSIDPsw", ""); final Timer mtimer = new Timer(); mtimer.schedule(new TimerTask() { @Override public void run() { if (progressDialog.isShowing()) { progressDialog.cancel(); mtimer.cancel(); String failText=(String) getText(R.string.configuration_failed); Message msg=new Message(); msg.what=handler_key.FAILED.ordinal(); msg.obj=failText; handler.sendMessage(msg); } else { mtimer.cancel(); } } }, 10 * 1000); isChecked = true; while (isChecked) { String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this); if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) { if (checkNetwork(GosConfigCountdownActivity.this)) { GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null); progressDialog.cancel(); isChecked = false; handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); } if(broadcase==null){ broadcase = new GosWifiChangeReciver(); registerReceiver(broadcase, filter); } } } }