react-native-sunmi-inner-scanner icon indicating copy to clipboard operation
react-native-sunmi-inner-scanner copied to clipboard

Not getting result from SunmiInnerScanner

Open kenhuang opened this issue 7 years ago • 16 comments

Thanks for the awesome work on this library, I was able to open sunmi scanner using eject Expo client, after finish scanning a QR code, I am not able to receive the result.

Let me know if require more information.

Client Code:

 render() {
  <Text style={styles.footerLink}  onPress={() => {
                            console.log('*******************'+this.state.result);
                            this._openDefaultScanner();
                        }} >Test</Text>
...


    async _openDefaultScanner(){
        let options={
            showSetting:true,
            showAlbum:true,
            paySound:true,
            payVibrate:true,// V1 not support
        }
        let result = await SunmiInnerScanner.openScannerWithOptions(options);
        console.log('*******************'+this.state.result);
        this.setState({result: JSON.stringify(result)}
            ,()=>{
                console.log('*******************'+this.state.result);
            });
...

Native Module debug code in SunmiInnerScannerModule.java:


@ReactMethod
public void openScannerWithOptions(ReadableMap options, final Promise p) {
    System.out.println("***********openScannerWithOptions: ");

@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
    System.out.println("***********onActivityResult: ");
    ...

Device Debug log:

10-31 07:30:47.251 11728-11728/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor
10-31 07:30:47.251 11728-11728/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1
10-31 07:30:47.380 11728-12105/com.xxx.mobile I/ReactNativeJS: *******************null
10-31 07:30:47.415 11728-12106/com.xxx.mobile I/System.out: ***********openScannerWithOptions:
10-31 07:30:47.415 11728-12106/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor
10-31 07:30:47.415 11728-12106/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1
10-31 07:30:47.417 11728-17622/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
10-31 07:30:47.451 11728-11728/com.xxx.mobile I/System.out: [CDS]close[39542]
10-31 07:30:47.453 11728-11728/com.xxx.mobile D/ScopedContext: WARNING: getPackageName called on ScopedContext
10-31 07:30:47.454 11728-11728/com.xxx.mobile W/GooglePlayServicesUtil: Google Play Store is missing.
10-31 07:30:47.458 11728-11728/com.xxx.mobile D/ActivityThread: ACT-AM_ON_PAUSE_CALLED ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}
10-31 07:30:47.469 11728-11728/com.xxx.mobile D/ActivityThread: ACT-PAUSE_ACTIVITY handled : 1 / android.os.BinderProxy@f063d26
10-31 07:30:47.469 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode()
10-31 07:30:47.469 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode()
10-31 07:30:47.636 11728-17622/com.xxx.mobile D/libc-netbsd: getaddrinfo: 4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct get result from proxy >>
10-31 07:30:47.637 11728-17622/com.xxx.mobile I/System.out: propertyValue:true
10-31 07:30:47.638 11728-17622/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:47.638 11728-17622/com.xxx.mobile I/System.out: [socket][106] connection 4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=53967(0)
10-31 07:30:47.639 11728-17622/com.xxx.mobile I/System.out: [CDS]connect[4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:90
10-31 07:30:47.640 11728-17622/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80
10-31 07:30:47.913 11728-17622/com.xxx.mobile I/System.out: [socket][/192.168.128.108:53967] connected
10-31 07:30:47.913 11728-17622/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:47.914 11728-16110/com.xxx.mobile I/System.out: [CDS]close[37799]
10-31 07:30:47.938 11728-13360/com.xxx.mobile I/System.out: [CDS]close[32950]
10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:857: [MALI] make current with display 0x1, context 0x40000001, state 0xb74664a0
10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:872: [MALI] Map __dpy 0x1 to dpy 0xb72e8f58
10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:906: [MALI] Map __ctx 0x40000001 to ctx 0xb7457ff0
10-31 07:30:47.986 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0)
10-31 07:30:47.987 11728-11826/com.xxx.mobile D/Surface: Surface::disconnect(this=0xb7122c98,api=1)
10-31 07:30:47.987 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb753a4c0) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:47.987 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb74b0d00) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:47.990 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0)
10-31 07:30:48.376 11728-11728/com.xxx.mobile V/ActivityThread: Finishing stop of ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}: show=false win=com.android.internal.policy.impl.PhoneWindow@89d5bc3
10-31 07:30:48.377 11728-11728/com.xxx.mobile D/ActivityThread: ACT-STOP_ACTIVITY_HIDE handled : 0 / android.os.BinderProxy@f063d26
10-31 07:30:48.377 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode()
10-31 07:30:48.377 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode()
10-31 07:30:48.377 11728-11728/com.xxx.mobile V/PhoneWindow: DecorView setVisiblity: visibility = 4 ,Parent =ViewRoot{a577e5d com.xxx.mobile/com.xxx.mobile.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 I.E..... R....... 0,0-540,888}
10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 2)
10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] 0xb74a8bf0 stop
10-31 07:30:48.389 11728-11826/com.xxx.mobile W/libutils.threads: Thread (this=0xb74afb28): getTid() is undefined before run()
10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] Exit thread hwuiTask1 (-1)
10-31 07:30:48.389 11728-11826/com.xxx.mobile W/libutils.threads: Thread (this=0xb74989a8): getTid() is undefined before run()
10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] Exit thread hwuiTask2 (-1)
10-31 07:30:48.390 11728-11826/com.xxx.mobile D/OpenGLRenderer: PathCache::clear count = 0
10-31 07:30:50.142 11728-11728/com.xxx.mobile D/ActivityThread: SEND_RESULT handled : 0 / ResultData{token=android.os.BinderProxy@f063d26 results[ResultInfo{who=null, request=2345, result=0, data=Intent { (has extras) }}]}
10-31 07:30:50.142 11728-11728/com.xxx.mobile V/ActivityThread: Performing resume of ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}
10-31 07:30:50.137 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0)
10-31 07:30:50.137 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0)
10-31 07:30:50.156 11728-11728/com.xxx.mobile D/ActivityThread: ACT-AM_ON_RESUME_CALLED ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}
10-31 07:30:50.156 11728-11728/com.xxx.mobile V/ActivityThread: Resume ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} started activity: false, hideForNow: false, finished: false
10-31 07:30:50.156 11728-11728/com.xxx.mobile V/ActivityThread: Resuming ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} with isForward=false
10-31 07:30:50.158 11728-11728/com.xxx.mobile V/ActivityThread: Scheduling idle handler for ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}
10-31 07:30:50.159 11728-11728/com.xxx.mobile D/ActivityThread: ACT-RESUME_ACTIVITY handled : 0 / android.os.BinderProxy@f063d26
10-31 07:30:50.156 11728-11728/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor
10-31 07:30:50.157 11728-11728/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1
10-31 07:30:50.158 11728-11728/com.xxx.mobile V/PhoneWindow: DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{a577e5d com.xxx.mobile/com.xxx.mobile.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 V.E..... R.....ID 0,0-540,888}
10-31 07:30:50.178 11728-11826/com.xxx.mobile D/OpenGLRenderer: CanvasContext() 0xb7438878 initialize 0xb759b928
10-31 07:30:50.178 11728-11826/com.xxx.mobile D/Surface: Surface::connect(this=0xb759b920,api=1)
10-31 07:30:50.180 11728-17681/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
10-31 07:30:50.190 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]window_type=1, is_framebuffer=0, errnum = 0
10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]surface->num_buffers=4, surface->num_frames=3, win_min_undequeued=1
10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]max_allowed_dequeued_buffers=3
10-31 07:30:50.190 11728-11826/com.xxx.mobile D/Surface: Surface::setBufferCount(this=0xb759b920,bufferCount=4)
10-31 07:30:50.192 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:857: [MALI] make current with display 0x1, context 0x40000001, state 0xb74664a0
10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:872: [MALI] Map __dpy 0x1 to dpy 0xb72e8f58
10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:906: [MALI] Map __ctx 0x40000001 to ctx 0xb7457ff0
10-31 07:30:50.192 11728-11826/com.xxx.mobile D/Surface: Surface::setBuffersDimensions(this=0xb759b920,w=540,h=888)
10-31 07:30:50.194 11728-17681/com.xxx.mobile D/libc-netbsd: getaddrinfo: packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct get result from proxy >>
10-31 07:30:50.194 11728-17681/com.xxx.mobile I/System.out: propertyValue:true
10-31 07:30:50.195 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:50.195 11728-11826/com.xxx.mobile D/Surface: Surface::allocateBuffers(this=0xb759b920)
10-31 07:30:50.196 11728-17681/com.xxx.mobile I/System.out: [CDS]rx timeout:10000
10-31 07:30:50.198 11728-17681/com.xxx.mobile I/System.out: [socket][107] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=49443(5000)
10-31 07:30:50.198 11728-17681/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:5
10-31 07:30:50.199 11728-17681/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80
10-31 07:30:50.217 11728-11728/com.xxx.mobile V/InputMethodManager: onWindowFocus: null softInputMode=16 first=true flags=#5810180
10-31 07:30:50.217 11728-11728/com.xxx.mobile V/InputMethodManager: START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 V.E..... R....... 0,0-540,888} ic=null tba=android.view.inputmethod.EditorInfo@3953a6ee controlFlags=#104
10-31 07:30:50.224 11728-17686/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
10-31 07:30:50.224 11728-17686/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:50.224 11728-17686/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [socket][108] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=35740(10000)
10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:10
10-31 07:30:50.230 11728-17686/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80
10-31 07:30:50.276 11728-17687/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
10-31 07:30:50.276 11728-17687/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0
10-31 07:30:50.276 11728-17687/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [socket][109] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=56892(10000)
10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:10
10-31 07:30:50.280 11728-17687/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80
10-31 07:30:50.460 11728-17681/com.xxx.mobile I/System.out: [socket][/192.168.128.108:49443] connected
10-31 07:30:50.460 11728-17681/com.xxx.mobile I/System.out: [CDS]rx timeout:10000
10-31 07:30:50.469 11728-17686/com.xxx.mobile I/System.out: [socket][/192.168.128.108:35740] connected
10-31 07:30:50.469 11728-17686/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:50.521 11728-17687/com.xxx.mobile I/System.out: [socket][/192.168.128.108:56892] connected
10-31 07:30:50.522 11728-17687/com.xxx.mobile I/System.out: [CDS]rx timeout:0
10-31 07:30:50.540 11728-11826/com.xxx.mobile D/Surface: Surface::setBuffersDimensions(this=0xb759b920,w=540,h=888)
10-31 07:30:50.541 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb742cfb8) (w:540 h:888 s:544 f:0x1 u:0x000f02)
10-31 07:30:52.930 11728-17581/com.xxx.mobile I/System.out: [socket][110:57402] exception
10-31 07:30:52.930 11728-17581/com.xxx.mobile I/System.out: [CDS]close[57402]

kenhuang avatar Oct 30 '17 23:10 kenhuang

I just tested in V1 , may I know what device you r working with?

发自我的 iPhone

在 2017年10月31日,上午7:57,kenhuang [email protected] 写道:

Thanks for the awesome work on this library, I was able to open sunmi scanner using eject Expo client, after finish scanning a QR code, I am not able to receive the result.

Let me know if require more information.

Client Code:

render() { <Text style={styles.footerLink} onPress={() => { console.log('*******************'+this.state.result); this._openDefaultScanner(); }} >Test</Text> ...

async _openDefaultScanner(){
    let options={
        showSetting:true,
        showAlbum:true,
        paySound:true,
        payVibrate:true,// V1 not support
    }
    let result = await SunmiInnerScanner.openScannerWithOptions(options);
    console.log('*******************'+this.state.result);
    this.setState({result: JSON.stringify(result)}
        ,()=>{
            console.log('*******************'+this.state.result);
        });

... Native Module debug code in SunmiInnerScannerModule.java:

@ReactMethod public void openScannerWithOptions(ReadableMap options, final Promise p) { System.out.println("***********openScannerWithOptions: ");

@Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { System.out.println("***********onActivityResult: "); ... Device Debug log:

10-31 07:30:47.251 11728-11728/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor 10-31 07:30:47.251 11728-11728/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1 10-31 07:30:47.380 11728-12105/com.xxx.mobile I/ReactNativeJS: *******************null 10-31 07:30:47.415 11728-12106/com.xxx.mobile I/System.out: ***********openScannerWithOptions: 10-31 07:30:47.415 11728-12106/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor 10-31 07:30:47.415 11728-12106/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1 10-31 07:30:47.417 11728-17622/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0 10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0 10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:47.417 11728-17622/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 10-31 07:30:47.451 11728-11728/com.xxx.mobile I/System.out: [CDS]close[39542] 10-31 07:30:47.453 11728-11728/com.xxx.mobile D/ScopedContext: WARNING: getPackageName called on ScopedContext 10-31 07:30:47.454 11728-11728/com.xxx.mobile W/GooglePlayServicesUtil: Google Play Store is missing. 10-31 07:30:47.458 11728-11728/com.xxx.mobile D/ActivityThread: ACT-AM_ON_PAUSE_CALLED ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} 10-31 07:30:47.469 11728-11728/com.xxx.mobile D/ActivityThread: ACT-PAUSE_ACTIVITY handled : 1 / android.os.BinderProxy@f063d26 10-31 07:30:47.469 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode() 10-31 07:30:47.469 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode() 10-31 07:30:47.636 11728-17622/com.xxx.mobile D/libc-netbsd: getaddrinfo: 4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct get result from proxy >> 10-31 07:30:47.637 11728-17622/com.xxx.mobile I/System.out: propertyValue:true 10-31 07:30:47.638 11728-17622/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:47.638 11728-17622/com.xxx.mobile I/System.out: [socket][106] connection 4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=53967(0) 10-31 07:30:47.639 11728-17622/com.xxx.mobile I/System.out: [CDS]connect[4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:90 10-31 07:30:47.640 11728-17622/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80 10-31 07:30:47.913 11728-17622/com.xxx.mobile I/System.out: [socket][/192.168.128.108:53967] connected 10-31 07:30:47.913 11728-17622/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:47.914 11728-16110/com.xxx.mobile I/System.out: [CDS]close[37799] 10-31 07:30:47.938 11728-13360/com.xxx.mobile I/System.out: [CDS]close[32950] 10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:857: [MALI] make current with display 0x1, context 0x40000001, state 0xb74664a0 10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:872: [MALI] Map __dpy 0x1 to dpy 0xb72e8f58 10-31 07:30:47.986 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:906: [MALI] Map __ctx 0x40000001 to ctx 0xb7457ff0 10-31 07:30:47.986 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0) 10-31 07:30:47.987 11728-11826/com.xxx.mobile D/Surface: Surface::disconnect(this=0xb7122c98,api=1) 10-31 07:30:47.987 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb753a4c0) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:47.987 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb74b0d00) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:47.990 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0) 10-31 07:30:48.376 11728-11728/com.xxx.mobile V/ActivityThread: Finishing stop of ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}}: show=false win=com.android.internal.policy.impl.PhoneWindow@89d5bc3 10-31 07:30:48.377 11728-11728/com.xxx.mobile D/ActivityThread: ACT-STOP_ACTIVITY_HIDE handled : 0 / android.os.BinderProxy@f063d26 10-31 07:30:48.377 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode() 10-31 07:30:48.377 11728-11728/com.xxx.mobile V/TextView: stopSelectionActionMode() 10-31 07:30:48.377 11728-11728/com.xxx.mobile V/PhoneWindow: DecorView setVisiblity: visibility = 4 ,Parent =ViewRoot{a577e5d com.xxx.mobile/com.xxx.mobile.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 I.E..... R....... 0,0-540,888} 10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 2) 10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] 0xb74a8bf0 stop 10-31 07:30:48.389 11728-11826/com.xxx.mobile W/libutils.threads: Thread (this=0xb74afb28): getTid() is undefined before run() 10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] Exit thread hwuiTask1 (-1) 10-31 07:30:48.389 11728-11826/com.xxx.mobile W/libutils.threads: Thread (this=0xb74989a8): getTid() is undefined before run() 10-31 07:30:48.389 11728-11826/com.xxx.mobile D/OpenGLRenderer: [TaskMgr] Exit thread hwuiTask2 (-1) 10-31 07:30:48.390 11728-11826/com.xxx.mobile D/OpenGLRenderer: PathCache::clear count = 0 10-31 07:30:50.142 11728-11728/com.xxx.mobile D/ActivityThread: SEND_RESULT handled : 0 / ResultData{token=android.os.BinderProxy@f063d26 results[ResultInfo{who=null, request=2345, result=0, data=Intent { (has extras) }}]} 10-31 07:30:50.142 11728-11728/com.xxx.mobile V/ActivityThread: Performing resume of ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} 10-31 07:30:50.137 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0) 10-31 07:30:50.137 11728-11826/com.xxx.mobile D/OpenGLRenderer: Flushing caches (mode 0) 10-31 07:30:50.156 11728-11728/com.xxx.mobile D/ActivityThread: ACT-AM_ON_RESUME_CALLED ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} 10-31 07:30:50.156 11728-11728/com.xxx.mobile V/ActivityThread: Resume ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} started activity: false, hideForNow: false, finished: false 10-31 07:30:50.156 11728-11728/com.xxx.mobile V/ActivityThread: Resuming ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} with isForward=false 10-31 07:30:50.158 11728-11728/com.xxx.mobile V/ActivityThread: Scheduling idle handler for ActivityRecord{2885a881 token=android.os.BinderProxy@f063d26 {com.xxx.mobile/com.xxx.mobile.MainActivity}} 10-31 07:30:50.159 11728-11728/com.xxx.mobile D/ActivityThread: ACT-RESUME_ACTIVITY handled : 0 / android.os.BinderProxy@f063d26 10-31 07:30:50.156 11728-11728/com.xxx.mobile D/FeatureProxyBase: FeatureProxyBase class constructor 10-31 07:30:50.157 11728-11728/com.xxx.mobile D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1 10-31 07:30:50.158 11728-11728/com.xxx.mobile V/PhoneWindow: DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{a577e5d com.xxx.mobile/com.xxx.mobile.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 V.E..... R.....ID 0,0-540,888} 10-31 07:30:50.178 11728-11826/com.xxx.mobile D/OpenGLRenderer: CanvasContext() 0xb7438878 initialize 0xb759b928 10-31 07:30:50.178 11728-11826/com.xxx.mobile D/Surface: Surface::connect(this=0xb759b920,api=1) 10-31 07:30:50.180 11728-17681/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0 10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0 10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:50.180 11728-17681/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 10-31 07:30:50.190 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]window_type=1, is_framebuffer=0, errnum = 0 10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]surface->num_buffers=4, surface->num_frames=3, win_min_undequeued=1 10-31 07:30:50.190 11728-11826/com.xxx.mobile I/MaliEGL: [Mali]max_allowed_dequeued_buffers=3 10-31 07:30:50.190 11728-11826/com.xxx.mobile D/Surface: Surface::setBufferCount(this=0xb759b920,bufferCount=4) 10-31 07:30:50.192 11728-11826/com.xxx.mobile D/GraphicBuffer: unregister, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:857: [MALI] make current with display 0x1, context 0x40000001, state 0xb74664a0 10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:872: [MALI] Map __dpy 0x1 to dpy 0xb72e8f58 10-31 07:30:50.192 11728-11826/com.xxx.mobile D/MALI: _egl_make_current:906: [MALI] Map __ctx 0x40000001 to ctx 0xb7457ff0 10-31 07:30:50.192 11728-11826/com.xxx.mobile D/Surface: Surface::setBuffersDimensions(this=0xb759b920,w=540,h=888) 10-31 07:30:50.194 11728-17681/com.xxx.mobile D/libc-netbsd: getaddrinfo: packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct get result from proxy >> 10-31 07:30:50.194 11728-17681/com.xxx.mobile I/System.out: propertyValue:true 10-31 07:30:50.195 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb7575b08) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:50.195 11728-11826/com.xxx.mobile D/Surface: Surface::allocateBuffers(this=0xb759b920) 10-31 07:30:50.196 11728-17681/com.xxx.mobile I/System.out: [CDS]rx timeout:10000 10-31 07:30:50.198 11728-17681/com.xxx.mobile I/System.out: [socket][107] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=49443(5000) 10-31 07:30:50.198 11728-17681/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:5 10-31 07:30:50.199 11728-17681/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80 10-31 07:30:50.217 11728-11728/com.xxx.mobile V/InputMethodManager: onWindowFocus: null softInputMode=16 first=true flags=#5810180 10-31 07:30:50.217 11728-11728/com.xxx.mobile V/InputMethodManager: START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{3a7de6b9 V.E..... R....... 0,0-540,888} ic=null tba=android.view.inputmethod.EditorInfo@3953a6ee controlFlags=#104 10-31 07:30:50.224 11728-17686/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0 10-31 07:30:50.224 11728-17686/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:50.224 11728-17686/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0 10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [socket][108] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=35740(10000) 10-31 07:30:50.226 11728-17686/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:10 10-31 07:30:50.230 11728-17686/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80 10-31 07:30:50.276 11728-17687/com.xxx.mobile I/System.out: [CDS][DNS] getAllByNameImpl netId = 0 10-31 07:30:50.276 11728-17687/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: hostname=packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct; servname=(null); cache_mode=(null), netid=0; mark=0 10-31 07:30:50.276 11728-17687/com.xxx.mobile D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0 10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [socket][109] connection packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80;LocalPort=56892(10000) 10-31 07:30:50.278 11728-17687/com.xxx.mobile I/System.out: [CDS]connect[packager.4y-9j6.dev-wetech.xxx-mobile-detach.exp.direct/52.15.183.149:80] tm:10 10-31 07:30:50.280 11728-17687/com.xxx.mobile D/Posix: [Posix_connect Debug]Process com.xxx.mobile :80 10-31 07:30:50.460 11728-17681/com.xxx.mobile I/System.out: [socket][/192.168.128.108:49443] connected 10-31 07:30:50.460 11728-17681/com.xxx.mobile I/System.out: [CDS]rx timeout:10000 10-31 07:30:50.469 11728-17686/com.xxx.mobile I/System.out: [socket][/192.168.128.108:35740] connected 10-31 07:30:50.469 11728-17686/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:50.521 11728-17687/com.xxx.mobile I/System.out: [socket][/192.168.128.108:56892] connected 10-31 07:30:50.522 11728-17687/com.xxx.mobile I/System.out: [CDS]rx timeout:0 10-31 07:30:50.540 11728-11826/com.xxx.mobile D/Surface: Surface::setBuffersDimensions(this=0xb759b920,w=540,h=888) 10-31 07:30:50.541 11728-11826/com.xxx.mobile D/GraphicBuffer: register, handle(0xb742cfb8) (w:540 h:888 s:544 f:0x1 u:0x000f02) 10-31 07:30:52.930 11728-17581/com.xxx.mobile I/System.out: [socket][110:57402] exception 10-31 07:30:52.930 11728-17581/com.xxx.mobile I/System.out: [CDS]close[57402] — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

januslo avatar Oct 31 '17 01:10 januslo

both V1 and P1

kenhuang avatar Oct 31 '17 01:10 kenhuang

Have you checked the permissions? INTERNET permission is required. 发自我的 iPhone

在 2017年10月31日,上午9:59,kenhuang [email protected] 写道:

both V1 and P1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

januslo avatar Oct 31 '17 02:10 januslo

@kenhuang I updated the demo and tested with it. Result shows normal. You may test with my demo project to figure out whether the issue in the plugin with your device.

januslo avatar Oct 31 '17 03:10 januslo

Thanks for your quick response. Yes, I can confirm the example in the repo is working.

I think is related to the RN version that I am using, my project is setup using create-react-native-app with expo(the new default setup recommend by RN), expo kit comes with a custom version of expo SDK 22 - RN 0.49, the example is using RN 0.44.

Here are the steps how I set up the project.

create-react-native-app hello
cd hello
yarn install
yarn eject

npm i react-native-sunmi-inner-scanner --save
react-native link react-native-sunmi-inner-scanner

exp start, or use open Expo XDE
exp android, or open Android Studio open the `android` folder, after setup env then click "Run App"

Update node_modules/react-native-sunmi-inner-scanner/index.js to fix the compile error

import React,{Component} from 'react';// remove ,PropTypes
import PropTypes from 'prop-types'; //PropTypes
...
onCodeScan:PropTypes.func //change from React.PropTypes

Setup scan link in App.js to open sunmi scanner:

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

import SunmiInnerScanner, {SunmiScannerView} from 'react-native-sunmi-inner-scanner';

export default class App extends React.Component {
    static propTypes = {
    };

    state = {
        username: null,
        password: null,
        result: null,
        printer_status:""
    };

    async _openDefaultScanner() {
        let options = {
            showSetting: true,
            showAlbum: true,
            paySound: true,
            payVibrate: true,// V1 not support
        }
        let result = await SunmiInnerScanner.openScannerWithOptions(options);
        console.log('*******************' + this.state.result);
        this.setState({result: JSON.stringify(result)}
            , () => {
                console.log('*******************' + this.state.result);
            });
    }

  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
          <Text style={styles.footerLink} onPress={() => {
              console.log('*******************' + this.state.result);
              this._openDefaultScanner();
          }}>Scan</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#fff',
        alignItems: 'center',
        justifyContent: 'center',
    },
    footerLink: {
        color: '#69a4e9',
    },
});

After that, I am able to open the sunmi scanner but not able to receive any call back for the result...

kenhuang avatar Oct 31 '17 13:10 kenhuang

@januslo any luck using sunmi inner scanner with expo?

kenhuang avatar Nov 15 '17 00:11 kenhuang

@januslo seems related to this issue in expo https://github.com/expo/expo/issues/651

kenhuang avatar Nov 23 '17 01:11 kenhuang

Sorry for no response. However you may find the solution as you mention above.

januslo avatar May 03 '18 14:05 januslo

@kenhuang Did the solution in the expo issue work?

hewrin avatar Sep 23 '18 17:09 hewrin

@hewrin still problem here?

januslo avatar Sep 25 '18 04:09 januslo

@hewrin no the expo issue still open with P1 status... You might need to eject from expo and use the working version of RN or use the work around from the above expo/expo#651.

kenhuang avatar Sep 25 '18 09:09 kenhuang

@kenhuang emmm,how to say...... .. . the work around is using the "host.exp.exponent.ActivityResultListener " which from expo SDK. "react-native-sunmi-inner-scanner" is not the plugin specified for expo, i don't think it's good to apply this work around now. Don't you agree ?

januslo avatar Sep 25 '18 12:09 januslo

Yeah, it is also an issue after I ejected from Expo

hewrin avatar Sep 26 '18 03:09 hewrin

Although I am using the new VS2 Pro, so maybe it is compatibility issue?

hewrin avatar Sep 26 '18 03:09 hewrin

@hewrin actually, it should be the Expo issue, Expo should not impact other plugin that which using the REACT-NATIVE APIs, believe that Expo would provide its fix later. It's nothing about compatibility, not "react-native-sunmi-inner-scanner" compatibility problem at least.

januslo avatar Sep 26 '18 04:09 januslo

I agree, everything else in this library works fine with VS2Pro so far.

hewrin avatar Oct 09 '18 08:10 hewrin