1.判断定位是否打开
public static boolean getGpsStatus(Context ctx){
//从系统服务中获取定位管理器
LocationManager lm = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
return lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
}
2.跳转到打开定位的界面
public static void goToOpenGps(Context ctx){
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
ctx.startActivity(intent);
}