Monday 16 July 2018

Change screen orientation automatically while scanning (using ZXING library)

I've MainActivity.kt where I show different fragments for different needs. At some point, I press button 'X' that calls startScanner() function:

private fun startScanner() {
    IntentIntegrator(this)
            .setOrientationLocked(false)
            .setPrompt("SCANNING?")
            .initiateScan()
}

Manifest.xml:

<activity
    android:name=".MainActiity"
    android:theme="@style/AppTheme"
    tools:replace="android:screenOrientation"
    android:stateNotNeeded="true"
    android:screenOrientation="fullSensor"
    android:windowSoftInputMode="stateHidden" />

Gradle.file:

compile 'com.journeyapps:zxing-android-embedded:3.6.0'

It does open scanner and everything, but in landscape mode.

Why is this not working?



from Change screen orientation automatically while scanning (using ZXING library)

No comments:

Post a Comment