Skip to content

Initializing the SDK

James Goodwin edited this page Oct 13, 2016 · 9 revisions

In your Xamarin Forms page, create a new Judo instance:

var judo = new Judo()
{
    JudoId = "<JUDO_ID>",
    ApiToken = "<API_TOKEN>",
    ApiSecret = "<API_SECRET>",
    Environment = JudoEnvironment.Sandbox,
    Amount = 1.50m,
    Currency = "GBP",
    ConsumerReference = "YourUniqueReference"
};

Note: Please make sure that you are using a unique Consumer Reference for each different consumer.

Android

Due to a bug in Xamarin.Forms for Android that results in the page not resizing correctly when the keyboard is visible, an additional piece of code must be added to your Android Activity.

Add the code snippet after the Xamarin.Forms.Forms.Init method call inside the OnCreate method of your Activity:

Window.SetSoftInputMode(SoftInput.AdjustResize);
AndroidBugfix5497.assistActivity(this);

iOS

Xamarin.Forms for iOS has issues resolving dependencies registerered with DependencyService unless they have been registered.

Add this in your AppDelegate.cs after the LoadApplication(new App()) method call in your FinishedLaunching method:

DependencyService.Register<ClientService>();
DependencyService.Register<HttpClientHelper>();

// Required if using Apple Pay
DependencyService.Register<ApplePayService>();