Delphi FMX Android - How use Datalogic devices only through intents

Found this: In the Datalogic devices you have the possibility to start/stop the scan engine through an intent, without importing the SDK in the application

Tested, working (Delphi Alexandria).

But I completely didn’t understand, is it possible through intents read scanner’s states / scanned barcodes ( so, without using datalogic.jar )? Ideally, also setup settings…

Because with HoneyWell’s and Zebra’s SDK it is possible.
So far I see that only using datalogic.jar is only the way.

Every Java examples include those “import com.datalogic” rows.

Thank you so much.

Hi @Vitali_Bzot,

I suggest you take a look at this article: How to: Configure Datalogic devices through an Intent , which I think might be useful for you.

Donato Cataldo
L3 Mobile Computer Support Engineer

To have a first introduction to intent-based device configuration possibilities for Datalogic device you can read this article:

To start and stop a barcode acquisition through intents, as you probably already know, you can rely on the ACTION_START_DECODE and ACTION_STOP_DECODE intent actions made availbale by the BarcodeManager class.

Example:

`public int startDecodingIntent() {`
`  Intent myintent = new Intent();`
`  myintent.setAction(ACTION_START_DECODE);`
`}`

To receive the readed codes through intents, you need to disable the KeyBoardWedge service (active by default) and enable the IntentWedge, which is customizable, and which allows you to receive the barcode content and the barcode type through the extras of a customizable intent.
(see documentation on IntentWedge SDK class )

The Intent Wedge can be manually configured also through the Device’s UI, by navigating the menu Setting / Datalogic Settings / Scanner & decoder / Wedge:

The Datalogic SDK documentation, within a list of other sampels written in Kotlin and Java, also offers a specific DecodeIntent example app which covers the use of the Intent Wedge.

	public static final String ACTION_BROADCAST_RECEIVER = "com.datalogic.examples.decode_action";
	public static final String EXTRA_DATA_STRING = IntentWedge.EXTRA_BARCODE_STRING;

	// Receives action ACTION_BROADCAST_RECEIVER
	public class DecodeWedgeIntentReceiver extends BroadcastReceiver {
		@Override
		public void onReceive(Context context, Intent wedgeIntent) {
			String action = wedgeIntent.getAction();
			if (action.equals(ACTION_BROADCAST_RECEIVER)) {
				// Read content of result intent.
				String barcode = wedgeIntent.getStringExtra(EXTRA_DATA_STRING);
				Log.d(LOGTAG, "Decoding Broadcast Received");
			}
		}
	}

A ready-to-use .APK of that sample can be found here: DecodeIntent-Java.apk.

For a full list of the Datalogic SDK samples these are the links to the repositories for Datalogic Java SDK Samples and for Datalogic Kotlin SDK Samples ,

Finally for a list of other intents available on Datalogic device, check the documentation about Intenet class of the Datalogic SDK.

Simone Callegari
L3 - Mobile Products Specialist SW Engineer

1 Like

Thank you so much
I’ll check carefully all provided info

Thank you againt
As I have only Memor11 (with SDK 1.33) device, so all my tests based on this device.
Main question for me is enough use only intent-based coding (I mean, through an intent, without importing the SDK in the application) or I have to import the SDK in the application (I have not used yet *.jar in Delphi, probabaly it is possible).

Main idea - I have already working app on Zebra, HoneyWell devices, so I need also extend it to DataLogic (ideally in the same way).
That I used so far:

  1. Setting profile (well, Datalogic do not have it) - intent’s name, etc
    For example, I want to set everithing ready for my app before its running
  2. Buildin sound off, as I want to play own “good” and “bad” sound according to my logic
    For example if some code scanned successfully but related product not found, I wont to play “bad” sound
  3. In some frames I wont to switch scanning option off
    For example, if opened quantity input query it is good no to get user possibility to scan
  4. I need to read scanner states (my be in case of DataLogic it is not needed anymore) / SDK version

Now I think (Am I Right?) it is not possible to achieve all this without importing the SDK in the application?

Thank you so much.

So far I have got working app with detecting scanned barcodes.

Hi @Vitali_Bzot ,

  1. if your purpose is to develop an application only based on intents, there is no-need to import the *.jar or other references to the Datalogic SDK. Each device’s FW version supports a specific version of Datalogic SDK, as listed in the release notes of each FW or in the Supported devices table availabe on the Datalogic SDK documentation home page.

  2. About the “per-app profiles” there is a news. Starting from the most recent FWs and SDKs the Datalogic devices also support “per application” configuration profiles. The most convenient tool for configuring them is Scan2Deploy Studio.
    Under Device and Scanner Settings section, after defining a basic terminal configuration, you can also add new application-policies to vary specific settings that will be automatically applyed only when a specific application is in use.
    See the Application Policies page on the Scan2Deploy Studio documentation for more information.
    _
    Application-policies can also be created by code using the Profile Manager classes in the Datalogic SDK. See ProfileManager in the SDK documentation.

  3. To enable or disable the use of the ScanEngine there are two way: disable all trigger buttons that activate the scanner, or disable all ‘event listeners’ that utilize the scan engine. In that way, even if the triggers were still active, in the absence of listeners the Scan Engine would be completely disabled and would not come into operation.
    In the case of your Intents-based application, the listener that keeps the scanner active is the IntentWedge listener. So it would be sufficient to disable/enable the Intent Wedge to disable/enable the Scan Engine (of course make sure that the Keyboard Wedge and any other possible listener is disabled as well).
    For more information read the article: How to enable/disable the Scan Engine through Android Studio SDK

  4. Through intent, however, you cannot get the information about the FW or SDK of the device. This is only possible via SDK, with the class com.datalogic.device.info.

Regards
Simone

L3 - Mobile Products Specialist SW Engineer

Thank you so much for such excellent support

According to my needs, I have to import jar library - at least for managing settings (not possible to implement with intents), creating profile, getting SDK version …
Will try in Delphi

Some more questions:

  1. What is advantage using own profile (this created json file)? May be I don’t need it, just “default” settings is enough. In other devices I did it through own profile because I want to turn sound “off” and play own sound. In that case it wont influence widely…
  2. Is something special for “good” / “bad” beeps implementing? Is only the way - play sounds in my application (if I want to decide what is good / bad case) with switched off default sound?
  3. Can I check in GUI what profile(s) is using by my app / or available on device?
  4. As I tested, disabling scanner by unchecking all listeners in Wedge menu (Keyboard Wedge, Intent Wedge and Web Wedge) do the work. Is it enough? So if all 3 are unchecked, scanner will never go “on” I hope.
    Thank you.

Hello Bzot,

Generally speaking, the device has his base configuration.
You can modify it changing parameters

Speaking of Scan2Deploy, consider that you could also apply a configuration by exporting the content of a configuration as encrypted text and apply it to the device by sending an intent via Code or ADB:

image

Intent i = new Intent("datalogic.scan2deploy.intent.action.START_SERVICE")
    .putExtra("encoding", "v2")
    .putExtra("data",  "Bm9uiYc//NWOn...");
    .setClassName("com.datalogic.scan2deploy", "com.datalogic.scan2deploy.S2dServiceReceiver");
getApplicationContext().sendBroadcast(i);

or:
adb shell am broadcast -a datalogic.scan2deploy.intent.action.START_SERVICE -n "com.datalogic.scan2deploy/.S2dServiceReceiver" --es encoding v2 --es data '...'

For more info, see:

NOTE:
Once configured via Scan2Deploy or SDK, to date there is no way to verify on the device GUI which “app profile” is currently applied.

The advantage of the Scan2Deploy Studio’s Application policies is that they allow to define one or more “per-app configuration profiles” that are automatically activated by the system when a specific application is active. They are usefull when you have multiple application that requires different device base setting.
In this way applications will no longer have to worry about “adapting the system configuration to their operation” (often requiring the use of the SDK), because with the appropriate Application policies defined at the system level, it will be the system that will automatically reconfigure itself depending on the active application.

About the “good” / “bad” beeps, by default the system is set to notify any decoded label as a “goodread”, playing a beep and turning-on for a while the notification led and the GoodReed green light on the code label.
These behaviors are controlled by three different settings under Setting / Datalogic Setting / Scanner & decoder / GoodRead:

  • Enable good read (which enables the “goodread” beep)
  • Enable Green Spot
  • Enable good read LED
    Optionally, if available on the device, you can also activate the vibrator as a GoodRead notification.
    The menus under Setting / Datalogic Setting / Scanner & decoder / Notification allows to finetune the built-in good read notification.
    The same settings are available also in the SDK or via intents through the ConfigurationManager and the PropertyID classes. (see: GOOD_READ_ENABLE , GREEN_SPOT_ENABLE, etc…)

If you want to play different “good” / “bad” beeps based on some logic by you application, you have to disable the automatic good read audio feedback, validate the code received through the onRead event (or through the intent you configured in the IntentWedge) and then playing the sound you prefer by using the Android Standard APIs.

Finally, regarding the last question, yes, it is sufficient.
If there are no other active applications in the system that use the SDK to receive barcodes (or if they are closed or in the background and have themselves deregistered their listeners), deselecting all listeners in the Wedge menu (disable Keyboard Wedge, Intent Wedge, and Web Wedge) is sufficient to disable the scanner.

Simone
L3 - Mobile Products Specialist SW Engineer

Hi @Vitali_Bzot

I need to create an example application in Delphi Alexandria for a Memor K in which I only want to present the information that has been scanned.

If you can share some information, please email me at ccalado@glintt.com

Thanks a lot

Hi @Vitali_Bzot ,

I need develop with Delphi Alexandria too for Skorpio x5.
Can you share a little example of your tests, please?
I see you say “tested, working(Delphi Alexandria)”.

Thank´s .