another attempt to fix issue with not scanning on some devices
This commit is contained in:
parent
746ce2af75
commit
9f9bc54a85
1 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,7 @@ import android.app.Activity
|
|||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.util.Size
|
||||
import android.webkit.URLUtil
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
|
@ -120,7 +121,12 @@ fun Screen() {
|
|||
preview.setSurfaceProvider(previewView.surfaceProvider)
|
||||
val imageAnalysis = ImageAnalysis.Builder()
|
||||
.setBackpressureStrategy(STRATEGY_KEEP_ONLY_LATEST)
|
||||
.build()
|
||||
.setTargetResolution(
|
||||
Size(
|
||||
640, // previewView.width,
|
||||
480, // previewView.height
|
||||
)
|
||||
).build()
|
||||
imageAnalysis.setAnalyzer(
|
||||
ContextCompat.getMainExecutor(context),
|
||||
QrCodeAnalyzer { result -> code = result })
|
||||
|
|
Reference in a new issue