我正在使用以下代码开启/关闭GPS.
//Enable GPS
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
context.sendBroadcast(intent);
//Disable GPS
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", false);
context.sendBroadcast(intent);
Run Code Online (Sandbox Code Playgroud)
我可以通过编程方式在Android设备上开启/关闭GPS.我正在使用上面的代码.但它并不适用于所有设备.