Disable / enable NETWORK_PROVIDER on Android?

How to enable / disable NETWORK_PROVIDER on my AVD?

public class MyActivity extends Activity{ @Override protected void onResume(){ super.onResume(); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_PROVIDER); if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) Log.e("D", "ONLINE !"); else Log.e("D", "OFFLINE !"); } } 

Every time an action is created, I get through Logcat: OFFLINE! How to enable NETWORK_PROVIDER on AVD? As you can see, the Google location service is active.

enter image description here

+4
source share

Source: https://habr.com/ru/post/1488451/


All Articles