Intent intent = new Intent();
intent.setAction(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try
{
startActivity(intent);
} catch(ActivityNotFoundException ex)
{
// The Android SDK doc says that the location settings activity
// may not be found. In that case show the general settings.
// General settings activity
intent.setAction(Settings.ACTION_SETTINGS);
try {
startActivity(intent);
} catch (Exception e) {
}
}
Android打开系统GPS设置页面代码
最新推荐文章于 2024-11-16 09:05:20 发布