Open rits-development opened 5 years ago
Hi!
I suppose that your App is registering for receiving the Intent Wedge in the Manifest. Please, confirm it to have a complete understanding of the problem.
Anyway, Google introduced several limitations regarding Broadcast from Android 8, in order to improve dispatching performance. I strongly suggest to have a look here https://developer.android.com/about/versions/oreo/background#broadcasts. This could be very helpful to understand if your App is aligned to Android indications regarding this topic.
According to the Android documentation: “_Android 8.0 (API level 26) makes these limitations more stringent.
So, if your App registers itself for receiving the Intent Wedge in the Manifest, this approach works properly until Android 7. But instead, this feature will work as expected for all Android versions, If the App follows the new Google indication regarding the broadcast limitations, introduced by Android 8, that is to register the App to receive intents at runtime with the Context.registerReceiver() call.
Please, report us if this fixes your issue.
Hi I have the same issue...how did you solved it ?? Regards
Hi @laquint53, If you `"register the App to receive intents at runtime with the Context.registerReceiver() call", this should allow you to receive barcode data in an intent correctly.
Here are some sample apps that demonstrate calling registerReceiver()
:
DecodeIntent - Java DecodeIntent - Kotlin
For example, here the line in the Java example where registerReceiver()
is called:
https://github.com/datalogic/android-samples-astudio/blob/master/Java/DecodeIntent/app/src/main/java/com/datalogic/examples/decodeintent/IntentWedgeSample.java#L76
And as a best practice, unregisterReciver() should be called as well: https://github.com/datalogic/android-samples-astudio/blob/master/Java/DecodeIntent/app/src/main/java/com/datalogic/examples/decodeintent/IntentWedgeSample.java#L85
hi @codybrookshear Thanks for the reply, for the oser manufacturer (zebra, bluebird...) the code bellow works, i use a ScanReceiver to receive barcode date in an intent. For Datalogic it doesn't work...I prefer not use nugget package.
here my code :
private ScanReceiver _ScanReceiver; private IntentFilter _ScanFilter;
protected override void OnCreate(Bundle savedInstanceState) {
_ScanReceiver = new ScanReceiver(); _ScanFilter = new IntentFilter("com.datalogic.decodewedge.decode_action") _ScanFilter.AddCategory("com.datalogic.decodewedge.decode_category"); RegisterReceiver(_ScanReceiver, _ScanFilter); }
internal class ScanReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
if (intent?.Action == "com.datalogic.decodewedge.decode_category" //DataLogic
{
codebarre = intent.GetStringExtra("com.datalogic.decode.intentwedge.barcode_string");
appService.OnScanReceived(this, codebarre, null, null);
}
}
}
Ok, it's good to know you are doing Xamarin development. Even if you don't want to utilize our NuGet package ("Datalogic Xamarin SDK"), taking a look at our DecodeIntent sample app could be useful.
This sample only uses the Datalogic Xamarin SDK to configure the IntentWedge feature based on which of the 2 radio boxes are selected.
To avoid needing to use the Datalogic Xamarin SDK altogether, the IntentWedge settings could be configured ahead of time, for instance using the Settings app on the device (Settings > Datalogic Settings > Scanner Settings > Wedge > Intent wedge). Intent wedge is diabled by default. Other ways to configure this include using OEMConfig via an EMM/MDM or using Scan2Deploy Studio.
I'm trying to capture the intents broadcasted by the Intent Wedge which is enabled. However, my
BroadcastReceiver
isn't triggered.I checked the general system LogCat output and noticed the following when I trigger a scan:
It seems as if Android is dismissing the intent because it's not protected which might explain why my
BroadcastReceiver
isn't being triggered.Any idea?
Any help is highly appreciated!
Extra system info