1

I am working on an MDM/EMM application and this requires me to modify/circumvent the default google setup wizard to provision the device if its enrolled on our server.

My logic is as follows :-

1 - Add MDM apk as a system app in the ROM
2 - Start my App's activity before google setup wizard to check if device is enrolled on my server.
3 - If enrolled we provision the device, else we close our activity and allow the google setup wizard to continue

Issues faced in this approach -

We have hit a wall during this implementation of WiFi based check - For checking enrollment we have to force the user to connect to internet.

But during the WiFi Scan results are turning up empty on all devices. The same WiFi scan code works when run after the setup wizard completes.

Is there a special way to scan for WiFi before the Google Setup Wizard is completed?

Code I'm using is as follows :-

    final BroadcastReceiver wifiScanReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context c, Intent intent) {

            if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {

                List<ScanResult> mScanResults = mWifiManager.getScanResults();
              // this returns an empty list when run before the google setup wizard
            }
        }
    };

    mWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    mWifiManager.setWifiEnabled(true);
    getApplicationContext().registerReceiver(wifiScanReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
    mWifiManager.startScan();

Sadly the "mWifiManager.getScanResults()" returns an empty list when run before the Google setup wizard completes. This same code returns all available WiFi list when done after the google setup wizard completes.

We cannot provision the device if google setup is completed so the provisioning check has to happen before that :(

Prince Champappilly
  • 303
  • 1
  • 7
  • 29

0 Answers0