Android – Configure the SDK 2017-05-17T10:24:52+00:00

Android – Configure the SDK

Configuring Required Settings

1. At a minimum, before your app can use the SDK, you must set a number of configuration options. This task is performed through the JPConfiguration object and normally done once-only. However, these settings can be changed at any time.

2. At a minimum, you will need to set your developer account details and the Jetpay payment environment to be used (TEST or PRODUCTION for example).

For further details, please see the JetPay Android SDK Reference

Below, is some example code which performs this task:

import jetpay.co.uk.jetpay.JPConfiguration;

public class MyJetpayActivity extends Activity {

   void initJetpayConfig() {
      JPConfiguration myConfig = JPConfiguration.sharedConfiguration;
      myConfig.setEnvironmentType( JPConfiguration.JPEnvironmentType.Test );
      myConfig.setAccount( “Your Visa Developer ID”, “Your DeveloperID”, “Your TerminalID” );
   }
}

Configuring Optional Settings

1. Further to the required configuration settings, there are a number of optional settings.  For example, a JPTheme object can be added to JPConfiguration which dictates the visible nature (fonts, colours, borders, etc) of your SDK UI components when displayed.

2. All optional settings have default values. The global theme and required address fields all have default values for example.

For further details, please see the JetPay Full Android SDK Reference

Below is some example code which sets the theme and required address fields:

import jetpay.co.uk.jetpay.JPConfiguration;

public class MyJetpayActivity extends Activity {

   void initOptionalJetpayConfig() {
      JPConfiguration myConfig = JPConfiguration.sharedConfiguration;
      myConfig.setTheme( JPTheme.getDefaultTheme() );
      myConfig.setRequiredAddressFields( JPAddress.JPRequiredAddressFields.full );
   }
}