Skip to content

Commit fce7faa

Browse files
committed
DATAWEDGE decode_data added
1 parent 281c0e0 commit fce7faa

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

datawedge-MAUI-SampleApp/Platforms/Android/DWIntentReceiver.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Android.App;
22
using Android.Content;
33
using Android.OS;
4+
using Android.Runtime;
45
using Android.Util;
56
using AndroidX.Core;
67
using CommunityToolkit.Mvvm.Messaging;
@@ -14,12 +15,53 @@
1415
using System.Threading.Tasks;
1516
using System.Xml.Linq;
1617

18+
1719
namespace datawedge_MAUI_SampleApp.Platforms.Android
1820
{
1921

2022
[BroadcastReceiver(Enabled = true, Exported =true)]
2123
public class DWIntentReceiver : BroadcastReceiver
2224
{
25+
26+
public void ListExtrasKeys(Intent intent)
27+
{
28+
Bundle extras = intent.Extras;
29+
if (extras != null)
30+
{
31+
foreach (var key in extras.KeySet())
32+
{
33+
Log.Debug("", "Extra key: " + key);
34+
}
35+
}
36+
else
37+
{
38+
Log.Debug("", "No extras found");
39+
}
40+
}
41+
42+
public void DWDecodeData(Intent _intent)
43+
{
44+
45+
var jual = _intent.Extras.Get("com.symbol.datawedge.decode_data");
46+
47+
var javaList = jual as JavaList;
48+
49+
if (javaList != null)
50+
{
51+
for (int i = 0; i < javaList.Size(); i++)
52+
{
53+
byte[] bytes = (byte[])javaList.Get(i);
54+
foreach (var item in bytes)
55+
{
56+
Log.Info("decode_data", ""+item);
57+
}
58+
59+
60+
}
61+
}
62+
63+
}
64+
2365
public override void OnReceive(Context context, Intent intent)
2466
{
2567
System.Console.WriteLine("Here is DW on MAUI");
@@ -44,6 +86,10 @@ public override void OnReceive(Context context, Intent intent)
4486
String bc_type = intent.Extras.GetString("com.symbol.datawedge.label_type");
4587
String bc_data = intent.Extras.GetString("com.symbol.datawedge.data_string");
4688

89+
DWDecodeData(intent);
90+
91+
92+
4793
WeakReferenceMessenger.Default.Send(bc_type + " " + bc_data);
4894
}
4995
else if (intent.HasExtra("com.symbol.datawedge.api.RESULT_GET_ACTIVE_PROFILE"))
@@ -68,5 +114,6 @@ public override void OnReceive(Context context, Intent intent)
68114
}
69115
}
70116
}
117+
71118
}
72119
}

0 commit comments

Comments
 (0)