From ca6a0fc6757890af38fa3a3e8c9aa74a11c9e8e1 Mon Sep 17 00:00:00 2001 From: CXNT48 Date: Mon, 11 Nov 2024 14:50:55 +0100 Subject: [PATCH] NG Simulscan Multibarcode decoding added --- .../Platforms/Android/DWIntentReceiver.cs | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/datawedge-MAUI-SampleApp/Platforms/Android/DWIntentReceiver.cs b/datawedge-MAUI-SampleApp/Platforms/Android/DWIntentReceiver.cs index 166bae9..fc6d797 100644 --- a/datawedge-MAUI-SampleApp/Platforms/Android/DWIntentReceiver.cs +++ b/datawedge-MAUI-SampleApp/Platforms/Android/DWIntentReceiver.cs @@ -2,6 +2,7 @@ using Android.Content; using Android.OS; using Android.Util; +using AndroidX.Core; using CommunityToolkit.Mvvm.Messaging; using System; using System.Collections.Generic; @@ -17,14 +18,27 @@ namespace datawedge_MAUI_SampleApp.Platforms.Android { [BroadcastReceiver(Enabled = true, Exported =true)] -public class DWIntentReceiver : BroadcastReceiver - { - public override void OnReceive(Context context, Intent intent) - { + public class DWIntentReceiver : BroadcastReceiver + { + public override void OnReceive(Context context, Intent intent) + { System.Console.WriteLine("Here is DW on MAUI"); if (intent.Extras != null) { - if (intent.HasExtra("com.symbol.datawedge.label_type")) { + if (intent.HasExtra("com.symbol.datawedge.barcodes")) + { + WeakReferenceMessenger.Default.Send("NG SIMULSCAN - MULTIBARCODE DETECTED"); + List palobs = intent.Extras.GetParcelableArrayList("com.symbol.datawedge.barcodes").Cast().ToList(); + foreach (Bundle b in palobs) + { + String barcode = b.GetString("com.symbol.datawedge.data_string"); + String timestamp = b.GetString("com.symbol.datawedge.timestamp"); + String symbology = b.GetString("com.symbol.datawedge.label_type"); + WeakReferenceMessenger.Default.Send(symbology + " " + barcode); + } + } + else if (intent.HasExtra("com.symbol.datawedge.label_type")) + { String bc_type = intent.Extras.GetString("com.symbol.datawedge.label_type"); String bc_data = intent.Extras.GetString("com.symbol.datawedge.data_string"); @@ -50,13 +64,7 @@ public override void OnReceive(Context context, Intent intent) } catch (Exception e) { } } - } - - - - - - } - } + } + } }