3
私は、複数の権限が必要な場合は、チェックして要求する必要があるアプリを持っています。アプリを初めて実行するときだから、それはそれの後にあるすべての関数呼び出しをスキップし、でもアクセスユーザーがMarshmallowの許可を得るのを待つ方法
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()
を許可するをクリックした後、ユーザーがアクセス
を許可当たるまで、関数を呼び出すしないようにする方法はあります
私はあなたがこれを参照するべきだと思います。 http://stackoverflow.com/questions/30719047/android-m-check-runtime-permission-how-to-determine-if-the-user-checked-nev – niravmodi