I want to prompt the user for camera permissions before it changes activities. If the user allows then it will go to the QR code scanner and if the user denied it will return to the same screen.
Here is what I have at the moment
class ButtonGoToScannerClickListener implements View.OnClickListener {
@Override
public void onClick(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
ActivityCompat.requestPermissions(BaseMapActivity.this,
new String[]{Manifest.permission.CAMERA},
1);
Intent intent = new Intent(BaseMapActivity.this, BarCodeReaderActivity.class);
startActivityForResult(intent, ITEM_LOCATION_REQUEST);
}
}
}