打开GPS,有两种方式。代码如下: 进入GPS设置界面,再手动打开 Intent myIntent = new Intent(Settings.ACTION_SECURITY_SETTINGS ); startActivity(myIntent); 复制代码 直接打开GPS Intent gpsIntent = new Intent(); gpsIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); gpsIntent.addCategory("android.intent.category.ALTERNATIVE"); gpsIntent.setData(Uri.parse("custom:3")); try { PendingIntent.getBroadcast(GPSTestActivity.this, 0, gpsIntent, 0).send(); } catch (CanceledException e) { e.printStackTrace(); } 复制代码