您的位置:首页 > 移动开发 > Android开发

Android 直接打开Gps,不需要用户操作

2016-03-18 15:28 423 查看
本文转自:http://blog.sina.com.cn/s/blog_6651d94d01011lon.html

//打开Gps

public void openGrs(){

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(this, 0, GPSIntent, 0).send();

} catch (CanceledException e) {

e.printStackTrace();

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: