我有一个应用程序,需要检查并请求多个权限。因此,当应用程序第一次运行时,即使点击允许访问,它也会跳过所有在其后的函数调用。
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// Check Permissions Now
ActivityCompat.requestPermissions(
this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
REQUEST_CODE_LOCATION);
}
// Will not be called the first time
functionCall()
有没有办法在用户允许访问之前不调用该函数?