Using the Mobile SDK

What it Contains

The Mobile SDK contains a working copy of the source of the Tapp appfrom the play store as well as a SingleCard app.

The mobile SDK project also contains these packages that allow you to create your own Tap and Pay application

+ com.simplytapp.sdk

+ com.simplytapp.dependants

Setting up a New Tapp and Pay Project

Configure an Activity to be the Main "Pay" Screen

Extend an activity with CardEmu class that you would like to be the main payment activity screen:

public class CardEmuActivity extends CardEmu {

Configure some parameters for the SDK in the onCreate method of the activity:

    public void onCreate(Bundle savedInstanceState) {
    	setUseNfcEmu(true);  //use HCE emulation
    	setUsePin(true);     //use a PIN to enable easier authentication instead of user and pass at OAuth
    	setPin(null);  //set the pin from static storage
                       //it is possible, although not recommended to store the pin in shared preferences
    	setActiveCard(null);  //set the active card from static storage
                              //it is possible to set the active card id from one stored in shared preferences
    	Constants.setConsumerKey("");  //populate this with your Consumer Key
    	Constants.setConsumerSecret("");  	//populate this with your Consumer Secret
						//you may find a better way to store this remotely 
						//or obfuscate it somewhat in your bytecode or C++ extension
    	Constants.setOAuthCallbackHost("st_oauth_callback");  //set this to the callback you defined in the manifest
    	Constants.setOAuthCallbackScheme("x-oauthflow");      // and on the website settings


When the ApduService that ultimately services the card communication requests is triggered, it will notify this activity. getCardIntent() will allow you to set how this activity should be called from that service.

	protected Intent getCardIntent() {
		// set the way the activity intent is called from the ApduService here
		getIntent().addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
		return getIntent();

The SDK libraries have the ability to handle messaging notifications to the GUI from card events that come from cards that are loaded. If you would like your activity to manage these notifications exclusively, then you can configure this method:

    protected short getCardInterfaceMaskSetting()
    	//if you do not want the SDK to handle card 
    	//event dialogs, mask off the events this 
    	//activity should handle
        //CardEmu.HANDLE_CARD_ACTIVATING    //activating card notifications
        //CardEmu.HANDLE_CARD_APPROVING     //waiting for approval from user notifications
        //CardEmu.HANDLE_CARD_CREATING      //creating a card notifications
        //CardEmu.HANDLE_CARD_DEACTIVATING  //deactivating the card notifications
        //CardEmu.HANDLE_CARD_REMOTE_TASK   //card is doing a remote connection activity
        //CardEmu.HANDLE_CARD_TASK          //card is busy doing something notifications
        //CardEmu.HANDLE_CARD_TRANSACTING   //card is transacting notifications
   	return 0x00; 

Setup the type of activity the CardEmu activity extends inside

public class ActivityType extends Activity {



public class ActivityType extends ListActivity {


The dialogs that the SDK libraries use for Pin management such as setting a pin for a user and getting a pin from a user can be altered. the SDK needs to be setup to use a this class.

set the Pin management dialogs:

	protected PinInterface getPinInterfaceSetting() {
		//set the pin interface here
		return new PinDialogs();

Configuring XML

You may need to change the name of the main card payment activity below from com.simplytapp.sdk.CardEmuActivity to the one you choose.


        android:targetSdkVersion="19" />
    <uses-permission android:name="android.permission.NFC"></uses-permission> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.VIBRATE"></uses-permission>
    <uses-feature android:name="android.hardware.nfc" android:required="true"></uses-feature>
        android:label="@string/app_name" >
        <activity android:name="com.simplytapp.sdk.CardEmuActivity" android:screenOrientation="portrait" android:launchMode="singleTask">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
		<action android:name="android.intent.action.VIEW" />
		<category android:name="android.intent.category.DEFAULT" />
		<category android:name="android.intent.category.BROWSABLE" />
		<data android:scheme="x-payflow" android:host="add_card" />
        <activity android:name="com.simplytapp.oauth.PrepareRequestTokenActivity" android:launchMode="singleTask">
		<action android:name="android.intent.action.VIEW" />
		<category android:name="android.intent.category.DEFAULT" />
		<category android:name="android.intent.category.BROWSABLE" />
		<data android:scheme="x-oauthflow" android:host="st_oauth_callback" />
	<service android:name="com.simplytapp.virtualcard.ApduService" android:exported="true"
                <action android:name="android.nfc.HostApduService"/>
                <category android:name="android.intent.category.DEFAULT"/>
            <meta-data android:name="android.nfc.HostApduService" android:resource="@xml/aid_list"/>

tell the service which AIDs to respond to.

<host-apdu-service xmlns:android="" 
         <aid-group android:description="@string/paymentGroup" android:category="payment">
            <aid-filter android:name="325041592E5359532E4444463031"
            <aid-filter android:name="A0000000041010"
            <aid-filter android:name="A0000000031010"
            <aid-filter android:name="A0000002771010"


    <string name="app_name">My App</string>
    <string name="servicedesc">Payment Service</string>
    <string name="paymentGroup">Payment Service</string>
    <string name="ppse">PPSE</string>
    <string name="MasterCard">MasterCard</string>
    <string name="Visa">Visa</string>
    <string name="Interac">Interac</string>

On to Understanding SDK inherited methods