使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s

if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
        || ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED){
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

}

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

这句话放在这个if语句就可以

发表评论 / Comment

用心评论~