Not allowed to bind to service Intent

Hi all

 

after following the tutorial (https://developer.motorolasolutions.com/docs/DOC-2659) I am ending up with an error message from EMDKManager.getEMDKManager(.)

 

The message is: Not allowed to bind to service Intent { act=symbol.intent.action.emdkservice cmp=com.symbol.emdk.emdkservice/.EMDKService }

 

I added the required permissions to the manifest as shown in the tutorial.

 

what now ?

 

Cheerz

-ToM-

Thomas Wichser
hi all thank you very much

hi all

thank you very much for the replies and sry for the delay, I was quite busy last week.

OMG you're right shame on me lol

it works now

give thanks

-ToM-

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Gary Crean
The permission line says con

The permission line says con.symbol it should be com.symbol

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Thomas Wichser
No...but the very mysterious

No...

but the very mysterious Thing is that I found a demo-app in our local SVN repository and that one seems to work. I copied the code to my app and then it doesn't work anymore.

very, very strange

Cheerz

-ToM-

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Tom, would it be possible to

Tom, would it be possible to share your project or just your Main Activity and Manifest?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Thomas Wichser
Hello Bill Thx for your reply

Hello Bill


Thx for your reply.

Yes of course, here's the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="..." >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="con.symbol.emdk.permission.EMDK" />

    <application
        android:name=".THSApplication"
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library android:name="com.symbol.emdk" />
        <receiver android:name="..." >
            <intent-filter>
                <action android:name="android.intent.action.ACTION_SHUTDOWN" />
            </intent-filter>
        </receiver>
        <receiver android:name="..." >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".LoginActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoTitleBar"
            android:windowSoftInputMode="stateVisible" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
       
    </application>

</manifest>

and here is the code for the scanning activity:


public class ContainerActivity extends BaseActivity implements EMDKListener, StatusListener, DataListener {
    public static final String EXTRA_FLIGHT = "FLIGHT";
    private final SessionManager m_sessionManager;
    private final RTCServer m_rtcServer;
    private final ProfileManager m_profileManager;
    private final ContainerManager m_containerManager;
    private final Logger m_logger;
    private Flight m_flight = null;
    private ContainerListFragment m_listFragment = null;
    private ContainerNumberFragment m_containerFragment = null;
    private EMDKManager m_emdkManager = null;
    private BarcodeManager m_barcodeManager = null;
    private Scanner m_scanner = null;

    /***
     * Called when the activity is initializing.
     * @param savedInstanceState If the activity is being re-initialized after previously being
     *                           shut down then this Bundle contains the data it most recently
     *                           supplied in onSaveInstanceState(Bundle). Otherwise it is null.
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   
        EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);
        if(results.statusCode != EMDKResults.STATUS_CODE.SUCCESS) {
            // ToDo
        }

    } // onCreate


    private void initializeScanner() throws ScannerException {
        if (m_scanner == null) {
            m_barcodeManager = (BarcodeManager) this.m_emdkManager.getInstance(EMDKManager.FEATURE_TYPE.BARCODE);

            m_scanner = m_barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT);
            m_scanner.addDataListener(this);
            m_scanner.addStatusListener(this);
            m_scanner.triggerType = Scanner.TriggerType.HARD;
            m_scanner.enable();
            m_scanner.read();
        }
    }

    @Override
    public void onData(ScanDataCollection scanDataCollection) {
        new AsyncDataUpdate().execute(scanDataCollection);
    }

    @Override
    public void onOpened(EMDKManager emdkManager) {
        this.m_emdkManager = emdkManager;
        try {
            initializeScanner();
        } catch (ScannerException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onClosed() {

    }

    @Override
    public void onStatus(StatusData statusData) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (m_emdkManager != null) {
                m_emdkManager.release();
                m_emdkManager = null;
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        try {
            if (m_scanner != null) {
                m_scanner.disable();
                m_scanner = null;
            }
        } catch (ScannerException e) {
            e.printStackTrace();
        }
    }

    private class AsyncDataUpdate extends AsyncTask<ScanDataCollection, Void, String> {
         @Override
         protected String doInBackground(ScanDataCollection... params) {
             String result = null;
             try {
                 m_scanner.read();
                 ScanDataCollection scanDataCollection = params[0];
                 if (scanDataCollection != null && scanDataCollection.getResult() == ScannerResults.SUCCESS) {
                     ArrayList<ScanDataCollection.ScanData> scanData = scanDataCollection.getScanData();
                     for (ScanDataCollection.ScanData data : scanData) {
                         result = data.getData();
                         ScanDataCollection.LabelType labelType = data.getLabelType();
                     } // for
                 } // if
             } catch (ScannerException e) {
                 e.printStackTrace();
             }
             return result;
         }

         @Override
         protected void onPostExecute(String result) {
         }

         @Override
         protected void onPreExecute() {
         }

         @Override
         protected void onProgressUpdate(Void... values) {
         }
     }

} // ContainerActivity

Cheerz

-ToM-

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Tom, is this a GMS build (

Tom, is this a GMS build ( Google Mobile Services) ? 

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Thomas Wichser
Hi Bill I am using a TC55 (HW

Hi Bill

I am using a TC55 (HW 0x02) running android 4.4.3

cheerz

-ToM-

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Tom, As Gary pointed out, can

Tom, As Gary pointed out, can you change the permission name to com.symbol namespace and check to see if that fixes your issue? If so please mark Gary's reply as the correct answer.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Ah, great catch Gary, I

Ah, great catch Gary, I completely missed that.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hey Tom, The code looks good,

Hey Tom,

The code looks good, which device and OS version are you running this code on? 

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Topic locked