Android 12 can't connect reader (no Connect a Reader button)
Describe the issue
Hi there. My app, example from reader-sdk-flutter-plugin, example from react-native-square-reader-sdk working good on Android 11. But all of them on Android 12 on the screen where you connect reader, just don't have a button "Connect a Reader" (see first screenshot). I followed all instruction to update to Android 12 provided in instruction, migrated from 3.x to 4.x, added BLUETOOTH_CONNECT and BLUETOOTH_SCAN, removed extra code, updated SDK versions, but still - button disappear on Android 12. I spent several days trying different ways. I tried different versions of Flutter starting from 2.10.5 to 3.3.4. I updated permission_handler: ^10.1.0. And many other things - still button not appearing on Android 12 Because it is same and for flutter and for react native and in my app did by your instruction - I miss something in configuration. What am I missing to get button back? Thank you.
Error log details:
I/ViewRootImpl@81617[MainActivity](18712): ViewPostIme pointer 0
I/ViewRootImpl@81617[MainActivity](18712): ViewPostIme pointer 1
I/DecorView(18712): [INFO] isPopOver=false, config=true
I/DecorView(18712): updateCaptionType >> DecorView@7ea8a5c[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false
D/DecorView(18712): setCaptionType = 0, this = DecorView@7ea8a5c[]
I/DecorView(18712): getCurrentDensityDpi: from real metrics. densityDpi=213 msg=resources_loaded
I/ViewRootImpl@81617[MainActivity](18712): MSG_WINDOW_FOCUS_CHANGED 0 1
I/DecorView(18712): [INFO] isPopOver=false, config=true
I/DecorView(18712): updateCaptionType >> DecorView@6feb9c2[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false
D/DecorView(18712): setCaptionType = 0, this = DecorView@6feb9c2[]
I/DecorView(18712): getCurrentDensityDpi: from real metrics. densityDpi=213 msg=resources_loaded
I/Dialog (18712): mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
I/DecorView(18712): [INFO] isPopOver=false, config=false
I/DecorView(18712): updateCaptionType >> DecorView@ffd1772[], isFloating=false, isApplication=true, hasWindowControllerCallback=false, hasWindowDecorCaption=false
D/DecorView(18712): setCaptionType = 0, this = DecorView@ffd1772[]
I/DecorView(18712): getCurrentDensityDpi: from app context. densityDpi=213 msg=resources_loaded
I/DecorView(18712): notifyKeepScreenOnChanged: keepScreenOn=false
I/ViewRootImpl@433d1f[ApiMainActivity](18712): setView = com.android.internal.policy.DecorView@ffd1772 TM=true
I/Dialog (18712): mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
I/DecorView(18712): [INFO] isPopOver=false, config=false
I/DecorView(18712): updateCaptionType >> DecorView@c802259[], isFloating=false, isApplication=true, hasWindowControllerCallback=false, hasWindowDecorCaption=false
D/DecorView(18712): setCaptionType = 0, this = DecorView@c802259[]
I/DecorView(18712): getCurrentDensityDpi: from app context. densityDpi=213 msg=resources_loaded
I/DecorView(18712): notifyKeepScreenOnChanged: keepScreenOn=false
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): setView = com.android.internal.policy.DecorView@c802259 TM=true
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): stopped(false) old=false
I/ViewRootImpl@433d1f[ApiMainActivity](18712): stopped(false) old=false
I/reup.sdk.reade(18712): Background concurrent copying GC freed 117719(7806KB) AllocSpace objects, 87(4356KB) LOS objects, 42% free, 15MB/27MB, paused 186us,82us total 141.195ms
3
D/OpenGLRenderer(18712): setSurface called with nullptr
D/InputTransport(18712): Input channel destroyed: 'ClientS', fd=334
5
W/System (18712): A resource failed to call end.
I/DecorView(18712): notifyKeepScreenOnChanged: keepScreenOn=false
I/ViewRootImpl@96e1ace[ApiMainActivity](18712): setView = com.android.internal.policy.DecorView@6feb9c2 TM=true
I/BufferQueueConsumer(18712): [](id:491800000009,api:0,p:-1,c:18712) connect: controlledByApp=false
I/BLASTBufferQueue(18712): [ViewRootImpl@433d1f[ApiMainActivity]#9] constructor()
I/ViewRootImpl@433d1f[ApiMainActivity](18712): Relayout returned: old=(0,0,1340,800) new=(0,0,1340,800) req=(1340,800)0 dur=13 res=0x7 s={true -5476376628187979776} ch=true fn=-1
I/BufferQueueProducer(18712): [ViewRootImpl@433d1f[ApiMainActivity]#9(BLAST Consumer)9](id:491800000009,api:1,p:18712,c:18712) connect: api=1 producerControlledByApp=true
D/OpenGLRenderer(18712): eglCreateWindowSurface
I/ViewRootImpl@433d1f[ApiMainActivity](18712): [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:11420 android.view.ViewRootImpl.performTraversals:4193 android.view.ViewRootImpl.doTraversal:2919
D/ViewRootImpl@433d1f[ApiMainActivity](18712): Creating frameDrawingCallback nextDrawUseBlastSync=false reportNextDraw=true hasBlurUpdates=false
D/ViewRootImpl@433d1f[ApiMainActivity](18712): Creating frameCompleteCallback
D/ViewRootImpl@433d1f[ApiMainActivity](18712): Received frameDrawingCallback frameNum=1. Creating transactionCompleteCallback=false
D/ViewRootImpl@433d1f[ApiMainActivity](18712): Received frameCompleteCallback lastAcquiredFrameNum=1 lastAttemptedDrawFrameNum=1
I/BufferQueueConsumer(18712): [](id:49180000000a,api:0,p:-1,c:18712) connect: controlledByApp=false
I/BLASTBufferQueue(18712): [ViewRootImpl@ed4ce2a[ApiMainActivity]#10] constructor()
D/InsetsSourceConsumer(18712): ensureControlAlpha: for ITYPE_NAVIGATION_BAR on com.example.flutter.squareup.sdk.reader/com.squareup.ui.main.ApiMainActivity
D/InsetsSourceConsumer(18712): ensureControlAlpha: for ITYPE_STATUS_BAR on com.example.flutter.squareup.sdk.reader/com.squareup.ui.main.ApiMainActivity
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Relayout returned: old=(0,0,1340,800) new=(0,0,1340,800) req=(1340,800)0 dur=14 res=0x7 s={true -5476376628164284416} ch=true fn=-1
I/BufferQueueProducer(18712): [ViewRootImpl@ed4ce2a[ApiMainActivity]#10(BLAST Consumer)10](id:49180000000a,api:1,p:18712,c:18712) connect: api=1 producerControlledByApp=true
D/OpenGLRenderer(18712): eglCreateWindowSurface
D/AbsListView(18712): in onLayout changed
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:11420 android.view.ViewRootImpl.performTraversals:4193 android.view.ViewRootImpl.doTraversal:2919
D/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Creating frameDrawingCallback nextDrawUseBlastSync=false reportNextDraw=true hasBlurUpdates=false
D/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Creating frameCompleteCallback
D/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Received frameDrawingCallback frameNum=1. Creating transactionCompleteCallback=false
D/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Received frameCompleteCallback lastAcquiredFrameNum=1 lastAttemptedDrawFrameNum=1
I/BufferQueueConsumer(18712): [](id:49180000000b,api:0,p:-1,c:18712) connect: controlledByApp=false
I/BLASTBufferQueue(18712): [ViewRootImpl@96e1ace[ApiMainActivity]#11] constructor()
I/ViewRootImpl@96e1ace[ApiMainActivity](18712): Relayout returned: old=(0,0,1340,800) new=(0,0,1340,800) req=(1340,800)0 dur=14 res=0x7 s={true -5476376628162998272} ch=true fn=-1
I/BufferQueueProducer(18712): [ViewRootImpl@96e1ace[ApiMainActivity]#11(BLAST Consumer)11](id:49180000000b,api:1,p:18712,c:18712) connect: api=1 producerControlledByApp=true
D/OpenGLRenderer(18712): eglCreateWindowSurface
4
I/DecorView(18712): notifyKeepScreenOnChanged: keepScreenOn=false
I/ViewRootImpl@96e1ace[ApiMainActivity](18712): [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:11420 android.view.ViewRootImpl.performTraversals:4193 android.view.ViewRootImpl.doTraversal:2919
D/ViewRootImpl@96e1ace[ApiMainActivity](18712): Creating frameDrawingCallback nextDrawUseBlastSync=false reportNextDraw=true hasBlurUpdates=false
D/ViewRootImpl@96e1ace[ApiMainActivity](18712): Creating frameCompleteCallback
D/ViewRootImpl@96e1ace[ApiMainActivity](18712): Received frameDrawingCallback frameNum=1. Creating transactionCompleteCallback=false
D/ViewRootImpl@96e1ace[ApiMainActivity](18712): Received frameCompleteCallback lastAcquiredFrameNum=1 lastAttemptedDrawFrameNum=1
I/ViewRootImpl@96e1ace[ApiMainActivity](18712): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4995 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938
I/ViewRootImpl@96e1ace[ApiMainActivity](18712): [DP] rdf()
D/ViewRootImpl@96e1ace[ApiMainActivity](18712): reportDrawFinished (fn: -1)
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4995 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): [DP] rdf()
D/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): reportDrawFinished (fn: -1)
I/ViewRootImpl@433d1f[ApiMainActivity](18712): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4995 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938
I/ViewRootImpl@433d1f[ApiMainActivity](18712): [DP] rdf()
D/ViewRootImpl@433d1f[ApiMainActivity](18712): reportDrawFinished (fn: -1)
D/InsetsSourceConsumer(18712): ensureControlAlpha: for ITYPE_NAVIGATION_BAR on com.example.flutter.squareup.sdk.reader/com.squareup.ui.main.ApiMainActivity
D/InsetsSourceConsumer(18712): ensureControlAlpha: for ITYPE_STATUS_BAR on com.example.flutter.squareup.sdk.reader/com.squareup.ui.main.ApiMainActivity
I/ViewRootImpl@81617[MainActivity](18712): MSG_WINDOW_FOCUS_CHANGED 0 1
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Resizing android.view.ViewRootImpl@b02c716: frame=[0,32][1340,736] reportDraw=false forceLayout=false backDropFrame=Rect(0, 0 - 1340, 704)
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): Relayout returned: old=(0,0,1340,800) new=(0,32,1340,736) req=(1340,704)0 dur=11 res=0x1 s={true -5476376628164284416} ch=false fn=2
D/OpenGLRenderer(18712): setSurface() destroyed EGLSurface
D/OpenGLRenderer(18712): destroyEglSurface
I/BufferQueueProducer(18712): [ViewRootImpl@ed4ce2a[ApiMainActivity]#10(BLAST Consumer)10](id:49180000000a,api:1,p:18712,c:18712) disconnect: api 1
I/BufferQueueProducer(18712): [ViewRootImpl@ed4ce2a[ApiMainActivity]#10(BLAST Consumer)10](id:49180000000a,api:1,p:18712,c:18712) connect: api=1 producerControlledByApp=true
D/OpenGLRenderer(18712): eglCreateWindowSurface
I/ViewRootImpl@433d1f[ApiMainActivity](18712): Resizing android.view.ViewRootImpl@9dba897: frame=[0,32][1340,736] reportDraw=false forceLayout=false backDropFrame=Rect(0, 0 - 1340, 704)
I/ViewRootImpl@433d1f[ApiMainActivity](18712): Relayout returned: old=(0,0,1340,800) new=(0,32,1340,736) req=(1340,704)0 dur=9 res=0x1 s={true -5476376628187979776} ch=false fn=2
D/OpenGLRenderer(18712): setSurface() destroyed EGLSurface
D/OpenGLRenderer(18712): destroyEglSurface
I/BufferQueueProducer(18712): [ViewRootImpl@433d1f[ApiMainActivity]#9(BLAST Consumer)9](id:491800000009,api:1,p:18712,c:18712) disconnect: api 1
I/BufferQueueProducer(18712): [ViewRootImpl@433d1f[ApiMainActivity]#9(BLAST Consumer)9](id:491800000009,api:1,p:18712,c:18712) connect: api=1 producerControlledByApp=true
D/OpenGLRenderer(18712): eglCreateWindowSurface
I/WM-WorkerWrapper(18712): Worker result SUCCESS for Work [ id=15ebc571-bbfe-4212-8516-16c62f252fb6, tags={ com.squareup.logdriver.scheduling.LogDriverRouterWorker } ]
I/ViewRootImpl@81617[MainActivity](18712): MSG_WINDOW_FOCUS_CHANGED 0 1
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): handleResized, msg = 4 frames=ClientWindowFrames{frame=[0,32][1340,736] display=[0,0][1340,800] backdrop=[0,0][1340,704]} forceNextWindowRelayout=false displayId=0 frameChanged=false backdropFrameChanged=true configChanged=false displayChanged=false mNextDrawUseBlastSync=false mergedConfiguration={mGlobalConfig={1.0 ?mcc?mnc [en_US] ldltr sw600dp w1006dp h528dp 213dpi lrg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1340, 800) mAppBounds=Rect(0, 0 - 1340, 736) mMaxBounds=Rect(0, 0 - 1340, 800) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_90 mPopOver=off mFreeformTaskPinningState=unpinned} s.73 fontWeightAdjustment=0 ff=0 bf=0 bts=0 enb/d themeSeq=0} mOverrideConfig={1.0 ?mcc?mnc [en_US] ldltr sw600dp w1006dp h528dp 213dpi lrg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1340, 800) mAppBounds=Rect(0, 0 - 1340, 736) mMaxBounds=Rect(0, 0 - 1340, 800) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90 mPopOver=off mFreeformTaskPinningState=unpinned} s.2 fontWeightAdjustment=0 ff=0 bf=0 bts=0 enb/d themeSeq=0}}
I/ViewRootImpl@433d1f[ApiMainActivity](18712): handleResized, msg = 4 frames=ClientWindowFrames{frame=[0,32][1340,736] display=[0,0][1340,800] backdrop=[0,0][1340,704]} forceNextWindowRelayout=false displayId=0 frameChanged=false backdropFrameChanged=true configChanged=false displayChanged=false mNextDrawUseBlastSync=false mergedConfiguration={mGlobalConfig={1.0 ?mcc?mnc [en_US] ldltr sw600dp w1006dp h528dp 213dpi lrg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1340, 800) mAppBounds=Rect(0, 0 - 1340, 736) mMaxBounds=Rect(0, 0 - 1340, 800) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_90 mPopOver=off mFreeformTaskPinningState=unpinned} s.73 fontWeightAdjustment=0 ff=0 bf=0 bts=0 enb/d themeSeq=0} mOverrideConfig={1.0 ?mcc?mnc [en_US] ldltr sw600dp w1006dp h528dp 213dpi lrg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1340, 800) mAppBounds=Rect(0, 0 - 1340, 736) mMaxBounds=Rect(0, 0 - 1340, 800) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90 mPopOver=off mFreeformTaskPinningState=unpinned} s.2 fontWeightAdjustment=0 ff=0 bf=0 bts=0 enb/d themeSeq=0}}
I/ViewRootImpl@ed4ce2a[ApiMainActivity](18712): MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager(18712): startInputInner - Id : 0
I/InputMethodManager(18712): startInputInner - mService.startInputOrWindowGainedFocus
D/LeakCanary(18712): Watching instance of androidx.lifecycle.ReportFragment (androidx.lifecycle.ReportFragment received Fragment#onDestroy() callback) with key d766dc96-b39d-416e-906c-43a7e46ad51b
D/LeakCanary(18712): Watching instance of com.squareup.ui.ApiActivity (com.squareup.ui.ApiActivity received Activity#onDestroy() callback) with key cdb0e747-8e44-424f-b09d-8b3d02f9677d
D/LeakCanary(18712): Watching instance of com.squareup.DaggerReaderSdkReleaseAppComponent$AA_ComponentImpl (com.squareup.ui.ApiActivity-639b3ee5-5926-4199-95da-713dc3225bce destroyed) with key 245844fc-e9a3-4cd1-a0cf-0bb2e40daabc
I/WM-WorkerWrapper(18712): Worker result SUCCESS for Work [ id=638c41f5-2eab-47da-b47b-fa1094cd0d74, tags={ com.squareup.logdriver.scheduling.LogDriverRouterWorker } ]
I/reup.sdk.reade(18712): Background concurrent copying GC freed 128300(8701KB) AllocSpace objects, 58(2952KB) LOS objects, 41% free, 16MB/28MB, paused 879us,120us total 148.617ms
D/InputTransport(18712): Input channel destroyed: 'ClientS', fd=249
I/reup.sdk.reade(18712): Background concurrent copying GC freed 116723(7851KB) AllocSpace objects, 114(5832KB) LOS objects, 44% free, 15MB/27MB, paused 339us,122us total 129.796ms
I/reup.sdk.reade(18712): Background concurrent copying GC freed 104851(7130KB) AllocSpace objects, 112(5824KB) LOS objects, 45% free, 14MB/26MB, paused 398us,93us total 130.125ms
To Reproduce
Steps to reproduce the issue.
- Download flutter example.
- Run it.
- Give all permissions.
- Go reader settings. It will not be "Connect reader" button there.
Here is the piece of code that reproduce the issue.
void onReaderSDKSettings() async {
try {
await ReaderSdk.startReaderSettings(); // after this call it will appear screen without button on Android 12
isFirstSettingsClick = true;
} on ReaderSdkException catch (e) {
showDialog(
context: context,
builder: (context) => FailureDialog(
text: e.message ?? 'Square setting has failed',
),
);
isFirstSettingsClick = true;
}
}
Expected behavior
On connect reader screen should be "connect reader" button like it was on Android 11
Environment (please complete the following information):
- platform: Android
- OS and version: Android 12
- dev environment: MacOS M1
- Reader SDK version: 1.7.1
- Devices tested: Samsung Galaxy Tab A7 Lite, Xiaomi Redmi Note 10S
In addition: Run flutter doctor -v in your terminal and copy the results here.
~/Projects/office/src/art-app > flutter doctor -v
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.6 21G115 darwin-arm, locale en-US)
• Flutter version 2.10.5 at /Users/sergiinesterovskyi/fvm/versions/2.10.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (6 months ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/sergiinesterovskyi/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.72.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0
[✓] Connected device (2 available) • SM T220 (mobile) • R9PT70V3HPV • android-arm64 • Android 12 (API 31) • Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!
Screenshots

Additional context
We are experiencing the same issue running on Galaxy Tab S8. Our application was working 2-3 weeks ago, so we assume at this point, it's a change with a recent Samsung security update. The fact that it's not working on your Xaomi device is curious.
Yesterday, this was posted on the Samsung dev forums for the Android plugin: https://developer.squareup.com/forums/t/android-12-blank-square-reader-screen-after-enabling-bluetooth-in-reader-settings-connect-a-reader/7293
@nesterscript Thank you for writing your thorough bug report. Our work with the Square Reader SDK over the past year has been not great because we go weeks with a broken build waiting for a fix.
@nesterscript I was able to restore functionality to my app by locking in an older version of the Android Reader SDK:
in build.gradle
ext {
// Override the reader sdk version with the this parameter
readerSdkVersion = "1.6.1"
}
@mrseth01 I can confirm. 1.6.1 works on Android 12. Thank you so much for your help
Thank you for the help @mrseth01! Closing this issue now.