SDK Initialization
License Key
The Docutain Xamarin SDK needs a valid, non-expired license key in order to work.
- Android
- iOS
For Android the license is bound to the Package name which you can find in the AndroidManifest.xml
.
For iOS the license is bound to the Bundle Identifier which you can find in the Info.plist
.
Trial license
The Docutain SDK is a commercial product and requires a paid license for production use. In order to get a trial license, please visit our website via https://sdk.docutain.com/TrialLicense to generate a trial license key.
Production license
To get information about the SDK's functionality and pricing and to purchase a production license, please contact us.
Initialize the SDK
In order to use any functionality of the SDK, you must initialize it first.
- Xamarin.Forms
- Xamarin.Android
- Xamarin.iOS
Xamarin.Forms initialization contains 2 steps. The first step is to set the MainActivity
in your Android specific porject before calling LoadApplication(new App())
.
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Docutain.SDK.Xamarin.Forms.Platform.MainActivity = this;
LoadApplication(new App());
}
}
The second step is to initialize the Docutain SDK in your App's constructor.
using Docutain.SDK.Xamarin.Forms;
public partial class App : Application
{
public App()
{
InitializeComponent();
if (!DocutainSDK.InitSDK(YOUR_LICENSE_KEY))
{
//init of Docutain SDK failed, get the last error message
var error = DocutainSDK.LastError;
//your logic to deactivate access to SDK functionality
//...
}
MainPage = new MainPage();
}
}
Initialize the Docutain SDK in your MainActivity
.
using Docutain.SDK.Xamarin.Android;
public class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
if(!DocutainSDK.InitSDK(this.Application, YOUR_LICENSE_KEY))
{
//init of Docutain SDK failed, get the last error message
var error = DocutainSDK.LastError;
//your logic to deactivate access to SDK functionality
//...
}
}
}
Initialize the Docutain SDK in your AppDelegate
.
using Docutain.SDK.Xamarin.iOS;
public class AppDelegate : UIResponder, IUIApplicationDelegate
{
public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
if (!DocutainSDK.InitSDK(YOUR_LICENSE_KEY))
{
//init of Docutain SDK failed, get the last error message
var error = DocutainSDK.LastError;
//your logic to deactivate access to SDK functionality
//...
}
}
}
If the initialization fails, you are responsible to deactivate access to SDK functionality.
Logging
The SDK writes certain information into a log file. You can get the log file by calling Logger.TraceFile
. You can send this log file to us if you have any issues/bugs with the SDK. The Logger has certain levels that you can set depending on your needs. However, we suggest to leave the level to it's default value which ensures that in case of any issues/bugs we can get all the information we need from you.
- Xamarin.Forms
- Xamarin.Android
- Xamarin.iOS
//get the log file
var logFile = Logger.TraceFile;
//set the log level
Logger.SetLogLevel(Logger.Level.Verbose);
//get the log file
var logFile = Logger.TraceFile;
//set the log level
Logger.SetLogLevel(Logger.Level.Verbose);
//get the log file
var logFile = Logger.TraceFile;
//set the log level
Logger.SetLogLevel(Level.Verbose);
Depending on the log level, some temporary files get written. These files, if any, will be deleted everytime the SDK starts, so you don't need to worry about spamming the files dir.
If you like, you can delete these files manually by using DocutainSDK.DeleteTempFiles()
.