dlazaro66 / QRCodeReaderView

Modification of ZXING Barcode Scanner project for easy Android QR-Code detection and AR purposes
1.9k stars 491 forks source link

It takes a long time for the very first scan result #151

Open zengziwei789 opened 6 years ago

zengziwei789 commented 6 years ago

I tried this on few phones, Galaxy S8, Android 7.0, Nexus 5, Android 6.0.1. If I launch the app for the first time after swipe kill. It takes a longer time to get the onQRCodeRead callback(sometimes could be more than 1 minute). The QRCodeReaderView is inside a Relative layout. My code has similar structure as the sample. Part of the activity is like following.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_scanner);
    qrCodeReaderView = (QRCodeReaderView) findViewById(R.id.qr_decoder_view);
    qrCodeReaderView.setOnQRCodeReadListener(this);
    qrCodeReaderView.setQRDecodingEnabled(true);
    qrCodeReaderView.setBackCamera();
}

@Override
public void onResume() {
    super.onResume();
    qrCodeReaderView.startCamera();
}

@Override
public void onPause() {
    super.onPause();
    qrCodeReaderView.stopCamera();
}

@Override
public void onQRCodeRead(String text, PointF[] points) {
    qrCodeReaderView.setQRDecodingEnabled(false);
    DataCollectorLogger.logInfo("Scanned QR code content: " + text);
}
Marco77577 commented 5 years ago

I am experiencing the same problem. What's the issue here? Were you able to solve it?

It sometimes takes forever to read a QR code.

zengziwei789 commented 5 years ago

I turned to Google API: https://developers.google.com/android/reference/com/google/android/gms/vision/barcode/BarcodeDetector