Stream delivery with DataWedge not working in Android app?

I am trying to get a barcode in my application using DataWedge in a Motorola MC40N0. I have created a profile at DataWedge. The intent action is android.intent.action.DEFAULT and the Intent category is android.intent.category.MAIN and the selected broadcast intent. Activity in manifest:

 <activity
     android:name="com.myproject.activities.ScanActivity"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar" >
     <intent-filter>
         <action android:name="android.intent.action.DEFAULT" />
         <category android:name="android.intent.category.MAIN" />
     </intent-filter>
 </activity>

      

Below is the code I have in ScanActivity:

 IntentFilter filter = new IntentFilter("android.intent.action.DEFAULT");
 BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            String data = intent.getStringExtra("com.motorolasolutions.emdk.datawedge.data_string");
            System.out.println("scanned data: "+data);
        } catch (Exception ex) {
            System.out.println("exception in scanning: "+ex);
        }
    }
};
registerReceiver(receiver, filter);

      

But I am not getting anything. There is something wrong with the setting or the code. Thanks in advance.

+3


source to share


1 answer


Possibly the same datawedge error as described here .



Try removing the intent category in your datawedge profile config.

+3


source







All Articles