Android 访问精细位置的运行时权限
我正在为maps生成一个项目,并检查我试图对Android 访问精细位置的运行时权限,android,permissions,maps,Android,Permissions,Maps,我正在为maps生成一个项目,并检查我试图对ContextCompat使用if语句的权限。studio不接受checkSelfPermission 我的代码如下: private static final String FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION; if (ContextCompat.checkSelfPermission(this,getApplicationContext(),FINE_LOCATION)
ContextCompat使用if语句的权限。studio不接受checkSelfPermission
我的代码如下:
private static final String FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION;
if (ContextCompat.checkSelfPermission(this,getApplicationContext(),FINE_LOCATION)==
PackageManager.PERMISSION_GRANTED){
有什么建议吗?确保下一行中的
清单是从导入android.Manifest导入的代码>
private static final String FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION;
改变这个
if (ContextCompat.checkSelfPermission(this,getApplicationContext(),FINE_LOCATION)==
PackageManager.PERMISSION_GRANTED){
到
现在可以了,谢谢
if (ContextCompat.checkSelfPermission(this,FINE_LOCATION)==
PackageManager.PERMISSION_GRANTED){