Answer the question
In order to leave comments, you need to log in
LocationManager (Geolocation) trigger?
Hello. Tell me please. In Android 6+, to get a list of Wifi networks, you need to enable geolocation. The inclusion of geolocation occurs through the launch
if (!locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
Intent settingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(settingsIntent);
}
protected void onCreate(Bundle savedInstanceState) {
...
registerReceiver(gpsReceiver, new IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION));
...
}
private BroadcastReceiver gpsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().matches(LocationManager.PROVIDERS_CHANGED_ACTION)) {
//Do your stuff on GPS status change
Log.i("TEST_WIFI", "CHANGE LOCATION");
}
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question