Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Kroll.method
- public void getWirelessNetworks(KrollInvocation invocation) {
- if (Util.gEmulatorMode == false) {
- wifiMgr = (WifiManager) invocation.getTiContext().getActivity().getSystemService(Context.WIFI_SERVICE);
- receiver = new WifiReceiver();
- invocation.getTiContext().getActivity().registerReceiver(receiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
- wifiMgr.startScan();
- }
- }
- // @Kroll.
- class WifiReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context c, Intent intent) {
- if (Util.gEmulatorMode) {
- mNetworkList.initializeEmulator();
- } else {
- mNetworkList.initialize(wifiMgr.getScanResults());
- }
- JSONArray networksJSON = new JSONArray(mNetworkList.getNetworkList());
- // proxy.fireEvent("networksAvailable", networksJSON);
- }
- }
Add Comment
Please, Sign In to add comment