



The MultiActivity sample app demonstrates how to receive scanned barcode data through an Android intent while handling multiple activities. It configures DataWedge, changes scanner hardware at runtime, modifies scanner parameters at runtime, registers for scanner status notifications, and uses the software scan trigger via DataWedge Intent APIs.
Key features of this sample:
DataWedge API | App Functionality |
---|---|
Get DataWedge Status | Check whether DataWedge is enabled or disabled. |
Create Profile | Create a new profile without setting configurations. |
Set Config | Create or reset the profile for application requirements. |
Register for status notifications | Register to receive notifications via intent for scanner status changes. |
Soft Scan Trigger | Control scanning via soft scan trigger button. |
Enable/Disable Scanner Input Plug-in | Enable/Disable the Scanner Input Plug-in in use by the current active profile, which effectively disables scanning |
Switch Scanner Params | Temporarily update the settings of the active profile during runtime by passing scanner reader parameters as intent extras. |
Enumerate Scanners | Generate an index of scanners available on the device. |
Switch Scanner | Switch to a specific scanner at runtime to enable an optimal scanning device for the app, requirement or situation. |
Switch to Profile | Change the app association to the specified profile. |
Download and build the sample app.
Copy and launch the sample app on the device. The first activity appears, displaying the scanner status and active profile.
Press the physical trigger button or toggle the soft scan button to perform a scan. The barcode data and symbology is displayed. Tap Next to proceed to the next activity.
In this next activity, the app automatically attempts to switch to the associated profile, “MultiActivityProfile_2,” by invoking the Switch to Profile API. By default, the scanner is disabled.
Toggle Enable/Disable Scanner to activate it.
Press the physical trigger button or toggle the soft scan button to perform a scan. The barcode data and symbology is displayed.
Options:
Note: If the "Scanner status" is DISABLED, both options reset to their default state (disabled).
Press the physical trigger button or toggle the soft scan button to perform a scan. The scanned data is displayed. If Decode Screen Notification is enabled, the screen turns green briefly upon a successful decode.
(Optional) Use the DW Scanner dropdown to change the scanner hardware, if needed.
Related guides: