0
カメラ権限が無効になっている場合は、実行時カメラ権限ダイアログを呼び出すだけです。メソッドは、実行時カメラ権限のためにスーパータイプからメソッドをオーバーライドまたは実装しません。
という点で、三つの問題になっ:カメラの許可がとしての寄付無効になっている場合でも
1)の方法は、以下の方法のために、スーパータイプからメソッドをオーバーライドまたは実装していない
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_CAMERA: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
}
return;
}
// other 'case' lines to check for other
// permissions this app might request
}
}
2)許可を与えられた '0'は儀式を許可されていますか?
パーミッションが無効になっているとき、なぜその「0」を与えるのか分かりません。
デバイス:サムスンギャラクシーS6
int MY_PERMISSIONS_REQUEST_Camera=101;
if (mActivity.checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (mActivity.shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
// Show an expanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
mActivity.requestPermissions(new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_Camera);
// MY_PERMISSIONS_REQUEST_Camera is an
// app-defined int constant. The callback method gets the
// result of the request.
}
}
3)私は、実行時に許可を有効にした場合、アプリは私が欲しいしない再起動します。
誰もが上記の3つの問題のために私を助けてください...
ああ申し訳ありませんが、私は1行を逃しました:int MY_PERMISSIONS_REQUEST_Camera = 101; – Vji
ここで、このコード 'onRequestPermissionsResult()'を書いていますか?同じクラスの – rafsanahmad007
のみ。権限を有効にするために実行時のダイアログを表示している関数の下に表示されます。 – Vji