Table of Contents

Xamarin.Forms

Follow these simple steps below to integrate NurApi with your Xamarin.Forms project:

Step 1: Declare permissions

Before we can use functionality such as the device discovery, we have to declare some permissions first.

Note
  • The following permissions are required to identify RFID readers connected via USB or Bluetooth Low Energy.
  • Locate your AndroidManifest.xml at the Android project and within the project and add the following permissions to the file:
	<!-- Request legacy Bluetooth permissions on older devices. -->
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
	<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
	<uses-permission android:name="android.permission.BLUETOOTH" />
	<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
	<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
	<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
	<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
	<uses-feature android:name="android.hardware.usb.host" android:required="true" />
	<uses-permission android:name="android.permission.USB_PERMISSION" />

Step 2: Installing NurApi & Support libraries

Next, you'll need to install the following NuGet packages. You can easily find and install them using the NuGet package manager in Visual Studio.

Step 3: Initializing the Support libraries

Locate your MainActivity.cs from the Android project and add the following line inside the OnCreateBundle(bundle) override method.

NurApiDotNet.Android.Support.Init(this);

After correctly placing this line, it should resemble the following:

 protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
            NurApiDotNet.Android.Support.Init(this);
        }

Ready to Utilize NurApi

Congratulations! You're now fully equipped to leverage NurApi.