I am trying to get barcode in my app using DataWedge in Motorola MC40N0. I created a profile in DataWedge. Intent action is android.intent.action.DEFAULT and Intent category is android.intent.category.MAIN and selected intent delivery as broadcast intent. Activity in manifest is:
<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>
Following is the code which i have in my 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. Is there something wrong with setting or code. Thanks in advance.
Probably the same datawedge bug as described here.
Try to remove intent category in your datawedge profile config.