Kerumen / react-native-awesome-card-io

A complete and cross-platform card.io component for React Native (iOS and Android).
https://kerumen.github.io/react-native-awesome-card-io/
457 stars 135 forks source link

No data returned after function call (Android) #95

Closed otterbotter closed 6 years ago

otterbotter commented 6 years ago

Hi

I am able to call the scanCard() function, scan the card and submit the confirmation, but there is no data returned.

My application is correctly detached and linked AFAIK. I have tested on both a Huawei P10 Lite and Galaxy S8.

Attached is a log file of one complete interaction (click scan -> scan card -> enter CVV -> submit).

I am using:

My code:

import React, { Component } from 'react';
import { Picker, Platform, Text, StyleSheet, AppRegistry, View, ScrollView,
  Button, Alert, Animated, TouchableOpacity, TouchableNativeFeedback, TextInput
} from 'react-native';
import {
  createStackNavigator,
} from 'react-navigation';
import { CardIOModule, CardIOUtilities } from 'react-native-awesome-card-io';

class AlignItemsBasics extends Component {

  componentWillMount() {
     if (Platform.OS === 'ios') {
       CardIOUtilities.preload();
     }
   }

   scanCard() {
     CardIOModule
       .scanCard()
       .then(card => {
         console.log(card)

       })
       .catch(() => {
         console.log('error')
       })
   }

   render() {
     return (
       <View>
         <TouchableOpacity onPress={this.scanCard.bind(this)}>
           <Text>Scan card!</Text>
         </TouchableOpacity>
       </View>
     );
   }

Any help would be greatly appreciated. This library is core to what I'm developing and I'm quite stuck at the moment :)

67

69

otterbotter commented 6 years ago

Log output:

D/ViewRootImpl@9f3b79c[MainActivity]: ViewPostIme pointer 1 D/ViewRootImpl@9f3b79c[MainActivity]: ViewPostIme pointer 0 D/ViewRootImpl@9f3b79c[MainActivity]: ViewPostIme pointer 1 V/FA: Recording user engagement, ms: 418548 V/FA: Using measurement service Connecting to remote service D/SensorManager: unregisterListener ::
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false (HTTPLog)-Static: isSBSettingEnabled false V/FA: Activity paused, time: 159887022 D/ScopedContext: WARNING: getPackageName called on ScopedContext D/ScopedContext: WARNING: getPackageName called on ScopedContext D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=418548, _sc=MainActivity, _si=5846804705690422233}] D/ScopedContext: WARNING: getPackageName called on ScopedContext V/FA: Using measurement service Connection attempt already in progress D/ScopedContext: WARNING: getPackageName called on ScopedContext V/FA: onActivityCreated D/I18nManager: null not found. Attempting to look for en_ZA setting locale to:en V/FA: Using measurement service Connection attempt already in progress Activity resumed, time: 159887169 D/MEMORY: Native memory stats: (free/alloc'd/total)8009440/34982128/42991616 D/SensorManager: registerListener :: 6, LSM6DSL Acceleration Sensor, 66667, 0,
D/ViewRootImpl@291855c[CardIOActivity]: setView = DecorView@fc00065[CardIOActivity] TM=true MM=false D/ViewRootImpl@9f3b79c[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 D/FA: Connected to remote service V/FA: Processing queued up service tasks: 3 D/ViewRootImpl@291855c[CardIOActivity]: dispatchAttachedToWindow V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0 D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][0,0] new=[0,0][1080,2076] result=0x7 surface={valid=true 3387209728} changed=true D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format , EGLBoolean) returns 0x3000, [1080x2076]-format:1 D/OpenGLRenderer: eglCreateWindowSurface = 0xcae60f20 D/SurfaceView: BG show() Surface(name=Background for - SurfaceView - com.cbo.walletdemo/io.card.payment.CardIOActivity@50c1706@0) android.view.SurfaceView{50c1706 V.E...... ......ID 0,318-1080,1758} V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0 sf_framedrop debug : 0x4f4c, game : false, logging : 0 D/SurfaceView: surfaceCreated 1 android.view.SurfaceView{50c1706 V.E...... ......ID 0,318-1080,1758} D/CardScanner: Preview.surfaceChanged(holder?:true, f:4, w:1080, h:1440 ) D/ViewRootImpl@291855c[CardIOActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 2076) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1 MSG_WINDOW_FOCUS_CHANGED 1 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@99ec819 nm : com.cbo.walletdemo ic=null I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x3 surface={valid=true 3387209728} changed=false D/OpenGLRenderer: eglDestroySurface = 0xc259bf50 D/ViewRootImpl@9f3b79c[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x5 surface={valid=false 0} changed=true V/FA: Inactivity, disconnecting from the service V/Vibrator: Called vibrate(long[], int) API! vibrate(long[], int, AudioAttributes) API - PUID: 10048, PackageName: com.cbo.walletdemo, repeat: -1, AudioAttr: null V/Vibrator: Called vibrate(int, String, VibrationEffect, AudioAttributes) API - PUID: 10048, PackageName: com.cbo.walletdemo semVibrate - PUID: 10048, PackageName: com.cbo.walletdemo, token: android.os.Binder@ba6df16, effect: Waveform{mTimings=[0, 70, 10, 40], mAmplitudes=[0, -1, 0, -1], mRepeat=-1}, AudioAttr: null, Mag: -1, TYPE_EXTRA D/Camera: app passed NULL surface D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x1 surface={valid=true 3387209728} changed=false V/FA: Recording user engagement, ms: 46663 V/FA: Recording user engagement, ms: 46663 V/FA: Using measurement service Connecting to remote service D/SensorManager: unregisterListener ::
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false V/FA: Activity paused, time: 159933832 I/System.out: (HTTPLog)-Static: isSBSettingEnabled false D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=46663, _sc=CardIOActivity, _si=5846804705690422245}] V/FA: Using measurement service Connection attempt already in progress V/FA: onActivityCreated D/I18nManager: null not found. Attempting to look for en_ZA setting locale to:en D/ScrollView: initGoToTop V/FA: Using measurement service Connection attempt already in progress Activity resumed, time: 159933904 D/ViewRootImpl@83eaa7c[DataEntryActivity]: setView = DecorView@f11c18b[DataEntryActivity] TM=true MM=false D/ViewRootImpl@291855c[CardIOActivity]: MSG_WINDOW_FOCUS_CHANGED 0 D/FA: Connected to remote service V/FA: Processing queued up service tasks: 3 V/InputMethodManager: Not IME target window, ignoring D/ViewRootImpl@83eaa7c[DataEntryActivity]: dispatchAttachedToWindow V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0 D/ViewRootImpl@83eaa7c[DataEntryActivity]: Relayout returned: old=[0,0][0,0] new=[0,0][1080,2076] result=0x7 surface={valid=true 3389304832} changed=true D/mali_winsys: EGLint new_window_surface(egl_winsys_display
, void *, EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000, [1080x2076]-format:1 D/OpenGLRenderer: eglCreateWindowSurface = 0xcae61a88 D/ScrollView: onsize change changed D/ViewRootImpl@83eaa7c[DataEntryActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 2076) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1 MSG_WINDOW_FOCUS_CHANGED 1 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@d61333c nm : com.cbo.walletdemo ic=com.android.internal.widget.EditableInputConnection@c6748c5 V/InputMethodManager: getMaxLengthForEditText InputFilter = java.lang.NoSuchMethodException: getMaxLength [] getMaxLengthForEditText InputFilter = java.lang.NoSuchMethodException: getMaxLength [] I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x5 surface={valid=true 3387209728} changed=false W/View: dispatchProvideAutofillStructure(): not laid out, ignoring I/AssistStructure: Flattened final assist data: 2252 bytes, containing 1 windows, 9 views D/SurfaceView: BG show() Surface(name=Background for - SurfaceView - com.cbo.walletdemo/io.card.payment.CardIOActivity@50c1706@0) android.view.SurfaceView{50c1706 V.E...... ........ 0,318-1080,1758} D/SurfaceView: surfaceDestroyed 1 android.view.SurfaceView{50c1706 V.E...... ........ 0,318-1080,1758} D/SurfaceView: BG destroy() Surface(name=Background for - SurfaceView - com.cbo.walletdemo/io.card.payment.CardIOActivity@50c1706@0) android.view.SurfaceView{50c1706 V.E...... ........ 0,318-1080,1758} D/OpenGLRenderer: eglDestroySurface = 0xcae60f20 D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x5 surface={valid=false 0} changed=true D/ViewRootImpl@83eaa7c[DataEntryActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2076) ci=Rect(0, 72 - 0, 873) vi=Rect(0, 72 - 0, 873) or=1 D/ViewRootImpl@83eaa7c[DataEntryActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x1 surface={valid=true 3389304832} changed=false D/ScrollView: onsize change changed D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme key 1 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme key 0 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme key 1 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme key 0 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme key 1 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme pointer 0 D/ViewRootImpl@83eaa7c[DataEntryActivity]: ViewPostIme pointer 1 V/FA: Recording user engagement, ms: 3553 V/FA: Activity paused, time: 159937457 I/System.out: (HTTPLog)-Static: isSBSettingEnabled false I/System.out: (HTTPLog)-Static: isSBSettingEnabled false D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=3553, _sc=DataEntryActivity, _si=5846804705690422246}] D/ViewRootImpl@83eaa7c[DataEntryActivity]: MSG_WINDOW_FOCUS_CHANGED 0 V/CardIOActivity: EXTRA_SCAN_RESULT: {Visa: •••• •••• •••• 7725 expiry:9/2020 cvvLength:3} D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x1 surface={valid=false 0} changed=false V/FA: Activity resumed, time: 159937513 D/SensorManager: registerListener :: 6, LSM6DSL Acceleration Sensor, 66667, 0,
V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0 D/ViewRootImpl@9f3b79c[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 3387209728} changed=true D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface
, egl_color_buffer_format *, EGLBoolean) returns 0x3000, [1080x2220]-format:1 D/OpenGLRenderer: eglCreateWindowSurface = 0xc259c130 W/AsyncCondition: Could not find listener for key: devicePushToken I/ExponentNotificationIntentService: gcm Registration Token: f5QUgShI4vM:APA91bE0mnlfVEVlfRmqP7W6wDx2MK3zj6ySyN8f6kbIX10pw25nfFyPgF7ITWbwkPft_gQQmIWD6mjn9WdCFAyrsDEMi5JQPvGP7gkb2ilpsq5K_ruT8w-fzDgB03MwEkuHR3HX9cY2I3Nii8b6biet9DHIKlZXkA D/ViewRootImpl@9f3b79c[MainActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 1017) vi=Rect(0, 72 - 0, 1017) or=1 D/ViewRootImpl@9f3b79c[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@5f50a42 nm : com.cbo.walletdemo ic=null I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus W/IInputConnectionWrapper: performPrivateCommand on inactive InputConnection D/ViewRootImpl@291855c[CardIOActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x1 surface={valid=false 0} changed=false D/OpenGLRenderer: eglDestroySurface = 0xcae61a88 D/ViewRootImpl@83eaa7c[DataEntryActivity]: Relayout returned: old=[0,0][1080,2076] new=[0,0][1080,2076] result=0x5 surface={valid=false 0} changed=true D/ViewRootImpl@9f3b79c[MainActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 144) vi=Rect(0, 72 - 0, 144) or=1 D/ViewRootImpl@9f3b79c[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=true 3387209728} changed=false D/ViewRootImpl@291855c[CardIOActivity]: dispatchDetachedFromWindow D/InputEventReceiver: channel '1e7b3af com.cbo.walletdemo/io.card.payment.CardIOActivity (client)' ~ Disposing input event receiver. channel '1e7b3af com.cbo.walletdemo/io.card.payment.CardIOActivity (client)' ~NativeInputEventReceiver. D/ViewRootImpl@83eaa7c[DataEntryActivity]: dispatchDetachedFromWindow D/InputEventReceiver: channel 'cb0a62d com.cbo.walletdemo/io.card.payment.DataEntryActivity (client)' ~ Disposing input event receiver. D/InputEventReceiver: channel 'cb0a62d com.cbo.walletdemo/io.card.payment.DataEntryActivity (client)' ~NativeInputEventReceiver. V/FA: Inactivity, disconnecting from the service

otterbotter commented 6 years ago

Resolved (see #67) with peter's suggestions.

The problem is that I was creating my react native app first with create-react-native-app and then detaching from Expo.

After re-creating with react-native init ProjectName it worked as expected.

yvasiuk-sphere commented 6 years ago

@otterbotter please, close issue if it has been resolved successfully

otterbotter commented 6 years ago

@yvasiuk-sphere Closed - thanks.