Advanced Topics

This section covers detailed topics about the Anyline SDK Plugin on Xamarin. You will not require knowledge about these advanced topics in your every day use of the SDK. However, in case you need specific information about certain topics in the Anyline SDK, it will be covered here.

Enabling simultaneous Barcode scanning in Xamarin.Android

In order to use simultaneous barcode scanning, the Xamarin.GooglePlayServices.Vision Nuget package has to be installed via the Nuget package manager into your Xamarin.Android project. Therefore, it might be required to retarget the application for a higher Android version first, before the package can be installed. After the nuget package is installed, the target Android version can be lowered again in the project properties.

Additionally, the following XML code must be added into the AndroidManifest.XML:

<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode" />

Camera2 API - Enable hardware acceleration

In the Xamarin.Android quickstart guide it is described what features and permissions the AndroidManifest.XML should contain. Newer devices might use the new Camera2 API, therefore hardware acceleration must be enabled in the activity that renders the camera. Depending on the device, it might not be enough to add a android:hardwareAccelerated="true" property in the <application> tag in AndroidManifest.XML. So if the camera screen stays black, it’s necessary to set the hardware acceleration directly in C#.

[Activity(Label = "My Activity", HardwareAccelerated = true, ...)]
public class MainActivity : Activity, IBarcodeResultListener // ...
{
    ...
}