Motorola EMDK implements DataListener crash | Android Studio

408 Views Asked by At

I want to implement the DataListener from the Motorola EMDK to my class. If I implement the DataListener my App crashes.

My android Manifest looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.identwerk.pdacandroid"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="com.symbol.emdk.permission.EMDK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <uses-library android:name="com.symbol.emdk" android:required="false"/>


    <activity
        android:name=".Activities.MainActivity"
        android:configChanges="orientation"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <!-- <category android:name="android.intent.category.HOME"/> -->
            <!-- <category android:name="android.intent.category.DEFAULT"/> -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

How can I prevent my App from crashing?

I work with the TC55 in Android Studio on a Win PC

I hope you guys can help me

1

There are 1 best solutions below

0
On

First, be sure to have installed the EMDK runtime on the TC55. This is available on Zebra's support website together with the EMDK v4.0 downloads: EMDK-OSUPDATE-040003.zip.

Then, you can start working with:

<uses-library android:name="com.symbol.emdk" android:required="true"/>

to be sure that the EMDK library is loaded when you're running your app on the TC55.

If you're launching your application at boot time (as the default launcher), you can take a look at the getInstanceAsync so that you can register a callback to be called when the Mx Framework on the device is ready to accept commands.