1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /** * 强制帮用户打开GPS * * @param context */ public static final void { Intent GPSIntent = new Intent(); GPSIntent. ; GPSIntent. ; GPSIntent. ; try { PendingIntent.. ; } catch (CanceledException e) { e. ; } } /** * 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的 * * @param context * @return true 表示开启 */ public static final boolean { LocationManager locationManager = (LocationManager) context. ; // 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快) boolean gps = locationManager. ; // 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位) boolean network = locationManager. ; if (gps || network) { return true; } return false; } |
http://blog.csdn.net/android_ls/article/details/8605931
打开gps也没看到用root权限呀
回覆刪除