'Not receiving device's Intent Action in Android Xamarin.Forms app's BroadcastReceiver

I have an Android barcode scanner device (Urovo DT50) and I'm trying to create an app, with Xamarin.Forms in VS 2022, to receive and process the scanned value.

The device's Scanner Settings indicate it will send an Intent Action of android.intent.ACTION_DECODE_DATA. So, I created a simple BarcodeScannerReceiver class...

[BroadcastReceiver(Enabled = true)]
public class BarcodeScanReceiver : BroadcastReceiver
{
    public override void OnReceive(Context context, Intent intent)
    {
        string value = intent.GetStringExtra("key");
    }
}

My understanding is that this class would get registered to receive the action, but I can't get it reach a debugging breakpoint. Am I missing an important step, or am I way off base for what I think should be happening?

I've read that the AndroidManifest.xml file should get automatically updated to reflect the BroadcastReceiver, but I don't see anything to reflect this...

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.xamarinforms1" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="30" />
    <application android:label="XamarinForms1.Android" android:theme="@style/MainTheme"></application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.CAMERA" />
</manifest>

Thanks for any suggestions on how to receive the device's Intent Action.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source