简体   繁体   中英

Android device(4.0 or above) GPS turn on/off

对于Android设备(4.0或更高版本),是否可以使用Java代码关闭/打开GPS,而无需用户使用“设置”?

After Android 2.3 it is no longer possible. Only apps signed with manufacturer platform certificate can use that permission.

The correct thing is to send the user to the location settings page, and let him enable GPS if he wish. eg,

Intent i = new
 Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(i);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM