4 - 48 TC70x/TC75x Integrator Guide
Example
Comments
The scanner and its parameters are set based on the currently active Profile.
Set Default Profile
Use the setDefaultProfile API function to set the specified Profile as the default Profile.
Default Profile Recap
Profile0 is the generic Profile used when there are no user created Profiles associated with an application.
// first send the intent to enumerate the available scanners on the device
// define action string
String enumerateScanners = "com.symbol.datawedge.api.ACTION_ENUMERATESCANNERS";
// create the intent
Intent i = new Intent();
// set the action to perform
i.setAction(enumerateScanners);
// send the intent to DataWedge
context.this.sendBroadcast(i);
// now we need to be able to receive the enumerate list of available scanners
String enumeratedList = "com.symbol.datawedge.api.ACTION_ENUMERATEDSCANNERLIST";
String KEY_ENUMERATEDSCANNERLIST = "DataWedgeAPI_KEY_ENUMERATEDSCANNERLIST";
// Create a filter for the broadcast intent
IntentFilter filter = new IntentFilter();
filter.addAction(enumeratedList);
registerReceiver(myBroadcastReceiver, filter);
// now we need a broadcast receiver
private BroadcastReceiver myBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(enumeratedList)) {
Bundle b = intent.getExtras();
String[] scanner_list = b.getStringArray(KEY_ENUMERATEDSCANNERLIST);
}
}
};