SDK Initialization | Xamarin Barcode Scanner
License Key
In order to run the Scanbot SDK within your production app, you must purchase and use a valid Scanbot SDK license.
Each license key is valid only for a given app bundle identifier. You will be unable to use any of the SDK features if the license key is corrupted, expired, or invalid in any other way.
Trial License
The Scanbot SDK will run without a license for one minute per session! To get a free, "no-strings-attached" 7-day trial license, please submit the Trial License Form on our website.
Please kindly note that a trial license can only be used in a development and staging environment. You are not allowed to publish your app to the App Store, Play Store, or any 3rd party Android App Store with a trial license.
Purchase a Production License
To get pricing information and purchase a production license for the Scanbot SDK, please request a quote.
Initialize SDK & Register License
We provide free "no-strings-attached" developer support for the implementation & testing of the Scanbot SDK. If you encounter technical issues with integrating the Scanbot SDK or need advice on choosing the appropriate framework or features, please visit our Support Page.
The Scanbot Barcode Scanner SDK must be initialized before usage. Make sure to run the initialization as early as possible.
We recommend implementing the initialization in the Application
class of the Android and Forms app, and in the AppDelegate
class of the iOS app.
- Xamarin.Forms
- Xamarin.Droid
- Xamarin.iOS
Open your App.xaml.cs
, paste the following code and customize it according to your needs
App.xaml.cs
using System;
using Xamarin.Forms;
using ScanbotBarcodeSDK.Forms;
namespace YOUR.APP.NAMESPACE
{
public partial class App : Application
{
public const string Key = null;
public App()
{
InitializeComponent();
SBSDK.Initialize(new InitializationOptions
{
LicenseKey = Key,
LoggingEnabled = true,
});
}
}
}
Create a class called MainApplication.cs
, paste the following code and customize it according to your needs
MainApplication.cs
using System;
using Android.App;
using Android.Runtime;
using IO.Scanbot.Sdk.Barcode_scanner;
namespace YOUR.APP.NAMESPACE // <--- REPLACE THIS
{
// This is required in order to register the application class in the Android Manifest
[Application(LargeHeap = true)]
public class MainApplication : Application
{
// This empty constructor is required
public MainApplication(
IntPtr javaReference,
JniHandleOwnership transfer
): base(javaReference, transfer){}
public override void OnCreate()
{
base.OnCreate();
var initializer = new ScanbotBarcodeScannerSDKInitializer();
// Enables logging
initializer.WithLogging(true, false);
// To run in trial mode, simply comment out the following line:
initializer.License(this, "<your-license-key>");
// Initializes the SDK
initializer.Initialize(this);
}
}
}
Open your AppDelegate.cs
, paste the following code and customize it according to your needs
AppDelegate.cs
using ScanbotBarcodeSDK.iOS;
[Register("AppDelegate")]
public class AppDelegate : UIResponder, IUIApplicationDelegate
{
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// To run in trial mode, simply comment out the following line:
ScanbotSDK.SetLicense("<your-license-key>");
ScanbotSDK.SetLoggingEnabled(true);
//...
}
}
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.