mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

Fixed request camera permission flow to solve issue 173 #186

Closed devtronic closed 4 years ago

devtronic commented 4 years ago

Fixes the "request for camera permission" flow which previously caused an app crash which is described in #173 .

Cause: The scanner view was created before the permission was requested.

Fix: Create the scanner view after the permission was granted

Test:

# pubspec.yaml
dependencies:
  barcode_scan:
    git:
      url: https://github.com/mintware-de/flutter_barcode_reader.git
      ref: fix_173
ir2pid commented 4 years ago

the fix works for me

devtronic commented 4 years ago

@ir2pid I updated the PR. The permission should now be requested before the scanner activity is shown. Can you confirm if this fix still working for you?

embedur-sarathis commented 4 years ago

It won't work for me

devtronic commented 4 years ago

@embedur-sarathis : Which version are you using? And what does "It won't work for me" mean? Please provide more details including

embedur-sarathis commented 4 years ago

It works for ios. But Android, after give permission allow, then the app crash I am using barcode_scan 2.0.2 version Flutter version v1.16.3

Thanks, Sarathi


From: Julian Finkler notifications@github.com Sent: Tuesday, 14 April 2020, 01:19 To: mintware-de/flutter_barcode_reader Cc: Sarathi Kannan Subramanian; Mention Subject: Re: [mintware-de/flutter_barcode_reader] Fixed request camera permission flow to solve issue 173 (#186)

@embedur-sarathishttps://github.com/embedur-sarathis : Which version are you using? And what does "It won't work for me" mean? Please provide more details including

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mintware-de/flutter_barcode_reader/pull/186#issuecomment-613064623, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APFJO4FAHFYIA43SE7KFU23RMNUDFANCNFSM4KZUDP4Q.

devtronic commented 4 years ago

@embedur-sarathis I can't reproduce the problem on my Samsung Galaxy S8+. Please provide the log which contains a stacktrace with the crash that we can address the problem.

embedur-sarathis commented 4 years ago

Today I updated the version 3.0.0, after barcode scanning, data is not populated in ScanResult object, Also, none of the exception blocks not called Here is the log : W/ActivityThread(27646): handleWindowVisibility: no activity for token android.os.BinderProxy@b834c2b I/DecorView(27646): createDecorCaptionView >> DecorView@fe88007[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true D/InputTransport(27646): Input channel constructed: fd=111 D/ViewRootImpl@ac81cf6BarcodeScannerActivity: setView = DecorView@fe88007[BarcodeScannerActivity] TM=true MM=false D/ViewRootImpl@de539acMainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@252797c[MainActivity] D/InputMethodManager(27646): getNavigationBarColor() -1 D/ViewRootImpl@ac81cf6BarcodeScannerActivity: Relayout returned: old=[0,0][1080,2340] new=[0,0][1080,2340] result=0x7 surface={true 486554333184} changed=true D/mali_winsys(27646): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27646): eglCreateWindowSurface = 0x714b5b1980, 0x7148e5f010 D/ViewRootImpl@ac81cf6BarcodeScannerActivity: MSG_RESIZED: frame=[0,0][1080,2340] ci=[0,83][0,126] vi=[0,83][0,126] or=1 D/ViewRootImpl@ac81cf6BarcodeScannerActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@fe88007[BarcodeScannerActivity] D/InputMethodManager(27646): getNavigationBarColor() -855310 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@fe88007[BarcodeScannerActivity] D/InputMethodManager(27646): getNavigationBarColor() -855310 V/InputMethodManager(27646): Starting input: tba=com.netcomm.Netcomm ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(27646): startInputInner - Id : 0 I/InputMethodManager(27646): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(27646): Input channel constructed: fd=113 D/InputTransport(27646): Input channel destroyed: fd=101 D/SurfaceView(27646): onWindowVisibilityChanged(0) true me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......I. 0,0-0,0} of ViewRootImpl@ac81cf6[BarcodeScannerActivity] V/CameraPreview(27646): Cancelling autofocus D/ViewRootImpl@ac81cf6BarcodeScannerActivity: Relayout returned: old=[0,0][1080,2340] new=[0,0][1080,2340] result=0x1 surface={true 486554333184} changed=false D/SurfaceView(27646): show() Surface(name=SurfaceView - com.netcomm.Netcomm/de.mintware.barcode_scan.BarcodeScannerActivity@fe349cd@0[27646])/@0x5d11282 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......ID 0,0-1080,1984} D/SurfaceView(27646): surfaceCreated 1 #8 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......ID 0,0-1080,1984} D/SurfaceView(27646): surfaceChanged (1080,1984) 1 #8 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......ID 0,0-1080,1984} I/netcomm.Netcom(27646): Compiler allocated 4MB to compile void android.view.ViewRootImpl.performTraversals() D/SurfaceView(27646): show() Surface(name=SurfaceView - com.netcomm.Netcomm/de.mintware.barcode_scan.BarcodeScannerActivity@fe349cd@0[27646])/@0x5d11282 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......ID 0,0-1116,1984} D/SurfaceView(27646): surfaceChanged (1116,1984) 1 #5 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ......ID 0,0-1116,1984} D/ViewRootImpl@de539acMainActivity: stopped(true) old=false D/SurfaceView(27646): windowStopped(true) false io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} of ViewRootImpl@de539ac[MainActivity] D/SurfaceView(27646): show() Surface(name=SurfaceView - com.netcomm.Netcomm/com.embedur.urlink.MainActivity@96c3e7b@2[27646])/@0x3432c7a io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} D/SurfaceView(27646): surfaceDestroyed callback.size 1 #1 io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} W/libEGL (27646): EGLNativeWindowType 0x7148e5b010 disconnect failed D/SurfaceView(27646): destroy() Surface(name=SurfaceView - com.netcomm.Netcomm/com.embedur.urlink.MainActivity@96c3e7b@2[27646])/@0x3432c7a io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} D/SurfaceView(27646): onWindowVisibilityChanged(8) false io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} of ViewRootImpl@de539ac[MainActivity] W/libEGL (27646): EGLNativeWindowType 0x7148e1f010 disconnect failed D/OpenGLRenderer(27646): eglDestroySurface = 0x714b257280, 0x7148e1f000 D/ViewRootImpl@de539acMainActivity: Relayout returned: old=[0,0][1080,2340] new=[0,0][1080,2340] result=0x5 surface={false 0} changed=false D/ViewRootImpl@ac81cf6BarcodeScannerActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@fe88007[BarcodeScannerActivity] D/InputMethodManager(27646): getNavigationBarColor() -855310 D/ViewRootImpl@de539acMainActivity: stopped(false) old=true D/SurfaceView(27646): windowStopped(false) false io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} of ViewRootImpl@de539ac[MainActivity] D/ViewRootImpl@de539acMainActivity: stopped(false) old=false D/SurfaceView(27646): onWindowVisibilityChanged(0) true io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} of ViewRootImpl@de539ac[MainActivity] D/ViewRootImpl@de539acMainActivity: Relayout returned: old=[0,0][1080,2340] new=[0,0][1080,2340] result=0x7 surface={true 486556360704} changed=true D/mali_winsys(27646): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27646): eglCreateWindowSurface = 0x715dbd3080, 0x714904e010 D/SurfaceView(27646): show() Surface(name=SurfaceView - com.netcomm.Netcomm/com.embedur.urlink.MainActivity@96c3e7b@3[27646])/@0x6e7b5c9 io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} D/SurfaceView(27646): surfaceCreated 1 #8 io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} D/mali_winsys(27646): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 D/SurfaceView(27646): surfaceChanged (1080,2214) 1 #8 io.flutter.view.FlutterView{96c3e7b VFE...... ........ 0,0-1080,2214} D/ViewRootImpl@de539acMainActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@252797c[MainActivity] D/InputMethodManager(27646): getNavigationBarColor() -1 D/InputMethodManager(27646): prepareNavigationBarInfo() DecorView@252797c[MainActivity] D/InputMethodManager(27646): getNavigationBarColor() -1 V/InputMethodManager(27646): Starting input: tba=com.netcomm.Netcomm ic=null mNaviBarColor -1 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(27646): startInputInner - Id : 0 I/InputMethodManager(27646): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(27646): Input channel constructed: fd=103 D/InputTransport(27646): Input channel destroyed: fd=113 D/SurfaceView(27646): onWindowVisibilityChanged(8) false me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ........ 0,0-1116,1984} of ViewRootImpl@ac81cf6[BarcodeScannerActivity] D/SurfaceView(27646): show() Surface(name=SurfaceView - com.netcomm.Netcomm/de.mintware.barcode_scan.BarcodeScannerActivity@fe349cd@0[27646])/@0x5d11282 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ........ 0,0-1116,1984} D/SurfaceView(27646): surfaceDestroyed callback.size 0 #2 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ........ 0,0-1116,1984} D/SurfaceView(27646): destroy() Surface(name=SurfaceView - com.netcomm.Netcomm/de.mintware.barcode_scan.BarcodeScannerActivity@fe349cd@0[27646])/@0x5d11282 me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ........ 0,0-1116,1984} W/libEGL (27646): EGLNativeWindowType 0x7148e5f010 disconnect failed D/OpenGLRenderer(27646): eglDestroySurface = 0x714b5b1980, 0x7148e5f000 D/ViewRootImpl@ac81cf6BarcodeScannerActivity: Relayout returned: old=[0,0][1080,2340] new=[0,0][1080,2340] result=0x5 surface={false 0} changed=true D/ViewRootImpl@ac81cf6BarcodeScannerActivity: stopped(true) old=false D/SurfaceView(27646): windowStopped(true) false me.dm7.barcodescanner.core.CameraPreview{fe349cd V.E...... ........ 0,0-1116,1984} of ViewRootImpl@ac81cf6[BarcodeScannerActivity] D/ViewRootImpl@ac81cf6BarcodeScannerActivity: dispatchDetachedFromWindow D/InputTransport(27646): Input channel destroyed: fd=111

Question: In the camera view, if it is there in multiple barcodes, can I able to read multiple barcodes which is there in camera view at a time?

Regards, Sarathi


From: Julian Finkler notifications@github.com Sent: 15 April 2020 00:49 To: mintware-de/flutter_barcode_reader flutter_barcode_reader@noreply.github.com Cc: Sarathi Kannan Subramanian sarathis@embedur.com; Mention mention@noreply.github.com Subject: Re: [mintware-de/flutter_barcode_reader] Fixed request camera permission flow to solve issue 173 (#186)

@embedur-sarathishttps://github.com/embedur-sarathis I can't reproduce the problem on my Samsung Galaxy S8+. Please provide the log which contains a stacktrace with the crash that we can address the problem.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mintware-de/flutter_barcode_reader/pull/186#issuecomment-613633356, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APFJO4C5CUTTS4FXVVDJ6JDRMSZK3ANCNFSM4KZUDP4Q.