Writing NativeScript plugin for EMDK Android

Hi all,

 

actually I'm trying to write a NativeScript plugin to use the native EMDK on my device (especially the hardware scanner).

I'm using the EMDK for Android v6.3. From the coding perspective (only the java code - not the GUI) I'm pretty close to this sample: Basic Scanning Tutorial using Barcode API - Zebra Technologies Techdocs

 

Unfortunately the app crashes when I'm trying to get the barcodeManager:

barcodeManager = (BarcodeManager) this.emdkManager
   .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);

 

 

As far as I can see the most important details from the log files are:

07-07 16:08:39.141 21367 21367 D com.symbol.emdk.EMDKServiceConnection: The EMDK Service is now connected!

07-07 16:08:39.142 20029 20029 V MDM_TASK_BASE_SERVICE: onCreate

07-07 16:08:39.145 17334 17345 D com.symbol.emdk.emdkservice.MxServiceConnection: release: The connection to the MX Service is closing...

07-07 16:08:39.146 20029 20029 V MDM_TASK_BASE_SERVICE: onCreate end

07-07 16:08:39.146 20029 20029 V MDM_TASK_BASE_SERVICE: onStartCommand, startId: 1, action:null

07-07 16:08:39.146 20029 20029 V MDM_TASK_BASE_SERVICE: onStartCommand end

07-07 16:08:39.147 20029 21455 D MDM_TASK_BASE_SERVICE: TaskBaseService handle message: SEQUENCE_INTENT

07-07 16:08:39.147 20029 21455 D MDM_TASK_BASE_SERVICE: Worker entered work method, new_task: null

07-07 16:08:39.147 20029 21455 D MDM_TASK_BASE_SERVICE: TaskBaseService loadQueue

07-07 16:08:39.148 17334 17345 D com.symbol.emdk.emdkservice.MxServiceConnection: The connection to the MX Service is closed.!

07-07 16:08:39.148 17334 17345 D SvcEMDKManager: supportedcradle is null

07-07 16:08:39.148 17334 17345 D SvcEMDKManager: supportedDiagnostic is null

07-07 16:08:39.148 17334 17345 D SvcEMDKManager: #EMDK-SVC# ProfileService::nfnUnInitialize()

07-07 16:08:39.148 17334 17345 D com.symbol.emdk.emdkservice.MxServiceConnection: MxServiceConnection constructor

07-07 16:08:39.148 17334 17345 D com.symbol.emdk.emdkservice.MxServiceConnection: Binding Mx srvice...

07-07 16:08:39.157 17334 17345 D com.symbol.emdk.emdkservice.MxServiceConnection: MX binding request sent. State: true

07-07 16:08:39.157 17334 17345 D SvcEMDKManager: getVersion - Entering

07-07 16:08:39.157 17334 17334 D com.symbol.emdk.emdkservice.MxServiceConnection: onServiceConnected: Connected to MX service...

07-07 16:08:39.157 17334 17334 D MxVersionHandler: MxVersionHandler Constructor

07-07 16:08:39.158 17334 17345 D SvcEMDKManager: getVersion - Leaving

07-07 16:08:39.158 17334 17345 D SvcEMDKManager: EMDK Version=6.3.23.623

 

07-07 16:08:39.169 21367 21367 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7748980 in tid 21367 (tivescript.demo)

07-07 16:08:39.179  6387  7049 W Herrevad: Invalid mccmnc

07-07 16:08:39.186  6387  7049 W Herrevad: Invalid mccmnc

07-07 16:08:39.255  6387  7431 I DpmTcmClient: RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor

07-07 16:08:39.271   552   552 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

07-07 16:08:39.271   552   552 F DEBUG   : Build fingerprint: 'Zebra/TC56/TC56:6.0.1/01-15-01.7-MG-00/105:user/release-keys'

07-07 16:08:39.271   552   552 F DEBUG   : Revision: '0'

07-07 16:08:39.271   552   552 F DEBUG   : ABI: 'arm'

07-07 16:08:39.272   552   552 F DEBUG   : pid: 21367, tid: 21367, name: tivescript.demo  >>> org.nativescript.demo <<<

07-07 16:08:39.272   552   552 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7748980

07-07 16:08:39.285   552   552 F DEBUG   :     r0 12cc20e0  r1 70bb3df8  r2 0000005e  r3 70c54980

07-07 16:08:39.285   552   552 F DEBUG   :     r4 ab3fd840  r5 71138280  r6 f3a51ed0  r7 ab237d98

07-07 16:08:39.285   552   552 F DEBUG   :     r8 70e73f50  r9 f4d8f90c  sl f138f6e8  fp ffe948e0

07-07 16:08:39.285   552   552 F DEBUG   :     ip 00000400  sp ffe94788  lr f4d2a60f  pc f4a31c06  cpsr 20070030

07-07 16:08:39.287   552   552 F DEBUG   :

07-07 16:08:39.287   552   552 F DEBUG   : backtrace:

07-07 16:08:39.287   552   552 F DEBUG   :     #00 pc 000efc06  /system/lib/libart.so (_ZN3art9ArtMethod32FindDexMethodIndexInOtherDexFileERKNS_7DexFileEj+25)

07-07 16:08:39.287   552   552 F DEBUG   :     #01 pc 003e860b  /system/lib/libart.so (artQuickResolutionTrampoline+1654)

07-07 16:08:39.287   552   552 F DEBUG   :     #02 pc 000ea863  /system/lib/libart.so (art_quick_resolution_trampoline+34)

07-07 16:08:39.287   552   552 F DEBUG   :     #03 pc 000c9325  /data/dalvik-cache/arm/system@framework@com.symbol.emdk.jar@classes.dex (offset 0xc8000)

07-07 16:08:39.459   552   552 F DEBUG   :

07-07 16:08:39.459   552   552 F DEBUG   : Tombstone written to: /data/tombstones/tombstone_02

07-07 16:08:39.459   552   552 E DEBUG   : AM write failed: Broken pipe

07-07 16:08:39.461  1221  1255 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)

07-07 16:08:39.461  1221 21474 W ActivityManager:   Force finishing activity org.nativescript.demo/com.tns.NativeScriptActivity

07-07 16:08:39.501  1221  1253 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@4480a38

07-07 16:08:39.501  1221  1253 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@5199a11

07-07 16:08:39.511   455   455 E lowmemorykiller: Error writing /proc/21367/oom_score_adj; errno=22

07-07 16:08:39.542  1221 17357 I OpenGLRenderer: Initialized EGL, version 1.4

07-07 16:08:39.586  1221  4211 I WindowState: WIN DEATH: Window{699448d u0 org.nativescript.demo/com.tns.NativeScriptActivity}

07-07 16:08:39.588  1221  3569 I WindowState: WIN DEATH: Window{5cebefa u0 Toast}

 

I have no idea what's wrong with that. Maybe one important detail: In the log file are some messages like:

"ScannerFramework: [ScannerContextManager::GetUserContext] Context not found in valid contexts (17334)"

 

The context of the application is: com.tns.NativeScriptApplication

 

The same library is working really good if launched from Android Studio within a standard android app. However it's crashing when called from a nativescript plugin.

 

Maybe someone here can help me.

 

Thanks in advance and best regards,

Julian