not working on Android 8.0
Opened this issue ยท 8 comments
it's not working, test on android 8.0
here my code
`public class QrCodeActivity extends BaseActivity implements QrCodeView,
ActivityCompat.OnRequestPermissionsResultCallback,
QRCodeReaderView.OnQRCodeReadListener {
@Inject
QrCodeMvpPresenter<QrCodeView> mPresenter;
@BindView(R.id.qrdecoderview)
QRCodeReaderView mQrCodeReaderView;
@BindView(R.id.qr_result)
LatoTextView txtResult;
@BindView(R.id.lyt_qr_reader)
ViewGroup mLayout;
private static final int PERMISSION_REQUEST_CAMERA = 25;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qr);
getActivityComponent().inject(this);
overridePendingTransition(R.anim.anim_pop_up, R.anim.anim_push_up);
setUnBinder(ButterKnife.bind(this));
mPresenter.onAttach(this);
setUp();
}
@Override
public void onQRCodeRead(String text, PointF[] points) {
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode != PERMISSION_REQUEST_CAMERA) {
return;
}
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mPresenter.cameraPermissionGranted();
initQRCodeReaderView();
} else {
mPresenter.deniedCameraPermission();
}
}
@Override
protected void setUp() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED) {
initQRCodeReaderView();
} else {
requestCameraPermission();
}
}
@Override
public void initQRCodeReaderView() {
mQrCodeReaderView.setQRDecodingEnabled(true);
mQrCodeReaderView.setAutofocusInterval(2000L);
mQrCodeReaderView.setTorchEnabled(true);
mQrCodeReaderView.setBackCamera();
mQrCodeReaderView.startCamera();
}
@Override
public void requestCameraPermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
Snackbar.make(mLayout, "Camera access is required to display the camera preview.",
Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override public void onClick(View view) {
ActivityCompat.requestPermissions(QrCodeActivity.this, new String[] {
Manifest.permission.CAMERA
}, PERMISSION_REQUEST_CAMERA);
}
}).show();
} else {
Snackbar.make(mLayout, "Permission is not available. Requesting camera permission.",
Snackbar.LENGTH_SHORT).show();
ActivityCompat.requestPermissions(this, new String[] {
Manifest.permission.CAMERA
}, PERMISSION_REQUEST_CAMERA);
}
}
}
`
`
<RelativeLayout
android:id="@+id/lyt_qr"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.dlazaro66.qrcodereaderview.QRCodeReaderView
android:id="@+id/qrdecoderview"
android:layout_width="match_parent"
android:layout_height="400dp" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:layout_margin="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<net.winnerawan.wonderfood.ui.helper.LatoTextView
android:id="@+id/qr_result"
android:gravity="center"
android:textAllCaps="true"
android:layout_marginBottom="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<net.winnerawan.wonderfood.ui.helper.LatoTextView
android:text="@string/scan_table"
android:gravity="center"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
I also have this issue.
Same here
I also have this issue.
Same Issue.
Same issue
how did you solve it @GeronimoKTT ?
Hi, I managed to solved it,......want help or did you manage to solve it?
โฆ
On 27 June 2018 at 10:00, Wolf00Bomber @.***> wrote: Same Issue. โ You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#140 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AVWMChCRvsM0c3-8w9kOz6qkMNQKDLeYks5uAzuQgaJpZM4PoHI9 .
How did you solve it?