NOTIFY (Custom)
Custom Bluetooth Scanner Notifications offer enhanced flexibility and control over how notifications are presented on supported Bluetooth scanners. This feature allows for the customization of LED patterns, beep sounds, and vibration sequences after a scan from a Bluetooth scanner using Remote Scanner Management (RSM). These customizations enable various notification experiences tailored to an application’s requirements. This custom notifications API provides more refined control compared to the standard Notify (Bluetooth Scanner Notifications) API.
Custom notification functionality is available starting with the following DataWedge versions:
- Android 13: DataWedge v14.3.4 or later
- Android 14: DataWedge v15.0.28 or later
Supported Bluetooth Scanners with Device Identifiers:
Bluetooth Scanner | Device Identifier |
---|---|
DS3678 | BLUETOOTH_DS3678 |
RS5100 | BLUETOOTH_RS5100 |
RS6000 | BLUETOOTH_RS6000 |
RS6100 | BLUETOOTH_GENERIC |
Configuration Settings
Configurable settings for LED, beep, and vibration notifications:
- LED Settings:
- Color - Specify using RGB format (e.g.,
0xFF0000
for red). - On/Off Time - Define activation and deactivation times in milliseconds.
- Repeat Count - Set the number of times the LED pattern repeats.
- Color - Specify using RGB format (e.g.,
- Beep Settings:
- Frequency - Set in Hertz.
- On/Off Time - Define durations for each beep and pause in milliseconds.
- Repeat Count - Specify the number beep cycles.
- Vibration Settings:
- On/Off Time - Set durations for vibration and pause in milliseconds.
- Repeat Count - Specify the number of vibration repetitions.
Function Prototype
Create sub-bundles for LED, beep, and vibration settings. For example:
LED Settings:
Bundle ledSettings = new Bundle(); ledSettings.putInt("COLOR", 0xFF0000); // Red color ledSettings.putInt("ON_TIME", 500); // LED on for 500ms ledSettings.putInt("OFF_TIME", 500); // LED off for 500ms ledSettings.putInt("REPEAT_COUNT", 3); // Number of repetitions notificationSettings.putBundle("LED_SETTINGS", ledSettings);
Beep Settings:
Bundle beepSetting = new Bundle(); beepSetting.putInt("BEEP_FREQUENCY", 1000); // 1000Hz frequency beepSetting.putInt("ON_TIME", 500); // 500ms on beepSetting.putInt("OFF_TIME", 500); // 500ms off beepSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] beepSettings = new Parcelable[]{beepSetting}; notificationSettings.putParcelableArray("BEEP_SETTINGS", beepSettings);
Vibration Settings:
Bundle vibratorSetting = new Bundle(); vibratorSetting.putInt("ON_TIME", 500); // Vibration on for 500ms vibratorSetting.putInt("OFF_TIME", 500); // Vibration off for 500ms vibratorSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] vibratorSettings = new Parcelable[]{vibratorSetting}; notificationSettings.putParcelableArray("VIBRATOR_SETTINGS", vibratorSettings);
Parameters
ACTION [string]: "com.symbol.datawedge.api.ACTION" The intent action used to communicate with the DataWedge API.
EXTRA_DATA [string]: "com.symbol.datawedge.api.notification.NOTIFY" The extra data key used in the intent to pass the notification configuration.
DEVICE IDENTIFIER [string]: Device identifier of the supported Bluetooth scanner. Specifies the unique identifier for the Bluetooth scanner, such as "BLUETOOTH_RS6000".
NOTIFICATION_SETTINGS [Bundle]: A bundle containing notification configurations. Includes settings for LED, beep, and vibration notifications, each defined with specific parameters like color, frequency, on/off time, and repeat count.
Result Codes
DataWedge returns the following error codes if the app includes the intent extras SEND_RESULT
and COMMAND_IDENTIFIER
to enable the app to receive results using the DataWedge result intent mechanism. See Example, below.
- DATAWEDGE_DISABLED - DataWedge is disabled
- DEVICE_NOT_SUPPORTED - Device does not support notifications
- PARAMETER_INVALID - No values are specified in the RSM attribute array
- DEVICE_NOT_CONNECTED - Scanner is not connected
Procedure
Follow these instructions to configure custom notifications:
Initialize the Main Bundle - Create a
Bundle
to store all custom notification settings.Specify the Device Identifier - Use the
DEVICE_IDENTIFIER
key to assign a unique identifier for the Bluetooth scanner.Set Up Notification Details - Create sub-bundles for LED, beep, and vibration settings; see Function Prototype.
Send the Notification:
a. AddnotificationSettings
to thedeviceBundle
.
b. Use a broadcast intent to apply these settings.deviceBundle.putBundle("NOTIFICATION_SETTINGS", notificationSettings);
Example Code
This sample code demonstrates how to configure a notification with a red LED, a 1000Hz beep, and a vibration pattern:
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
// Initialize the main bundle for settings
Bundle deviceBundle = new Bundle();
// Assign the device identifier
deviceBundle.putString("DEVICE_IDENTIFIER", "BLUETOOTH_RS6000");
// Bundle for notification settings
Bundle notificationSettings = new Bundle();
// LED Settings
Bundle ledSettings = new Bundle();
ledSettings.putInt("COLOR", 0xFF0000); // Red color
ledSettings.putInt("ON_TIME", 500); // LED on for 500ms
ledSettings.putInt("OFF_TIME", 500); // LED off for 500ms
ledSettings.putInt("REPEAT_COUNT", 3); // Number of repetitions
notificationSettings.putBundle("LED_SETTINGS", ledSettings);
// Beep Settings
Bundle beepSetting = new Bundle();
beepSetting.putInt("BEEP_FREQUENCY", 1000); // 1000Hz frequency
beepSetting.putInt("ON_TIME", 500); // 500ms on
beepSetting.putInt("OFF_TIME", 500); // 500ms off
beepSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions
Parcelable[] beepSettings = new Parcelable[]{beepSetting};
notificationSettings.putParcelableArray("BEEP_SETTINGS", beepSettings);
// Vibration Settings
Bundle vibratorSetting = new Bundle();
vibratorSetting.putInt("ON_TIME", 500); // Vibration on for 500ms
vibratorSetting.putInt("OFF_TIME", 500); // Vibration off for 500ms
vibratorSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions
Parcelable[] vibratorSettings = new Parcelable[]{vibratorSetting};
notificationSettings.putParcelableArray("VIBRATOR_SETTINGS", vibratorSettings);
// Add notification settings to device bundle
deviceBundle.putBundle("NOTIFICATION_SETTINGS", notificationSettings);
// Intent to broadcast the notification configuration
Intent i = new Intent();
i.setAction("com.symbol.datawedge.api.ACTION");
// Create and add the notification configuration bundle
Bundle bundleNotificationConfig = new Bundle();
bundleNotificationConfig.putString("DEVICE_IDENTIFIER", "BLUETOOTH_RS6000");
bundleNotificationConfig.putBundle("NOTIFICATION_SETTINGS", notificationSettings);
// Bundle for notification
Bundle bundleNotify = new Bundle();
bundleNotify.putBundle("NOTIFICATION_CONFIG", bundleNotificationConfig);
// Add notification bundle to intent
i.putExtra("com.symbol.datawedge.api.notification.NOTIFY", bundleNotify);
// Broadcast the intent
this.sendBroadcast(i);
SEE ALSO:
Zebra Support Central | Integrator Guides, Product Manuals, Software Downloads and Support
LaunchPad | Zebra Developer Community
Intent | Android Developers
Intents and Intent Filters | Android Developers
Android Intents | Tutorial