What it ContainsThe 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 Setting up a New Tapp and Pay ProjectConfigure an Activity to be the Main "Pay" ScreenExtend 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: @Override 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 super.onCreate(savedInstanceState); } 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. @Override 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: @Override protected short getCardInterfaceMaskSetting() { //if you do not want the SDK to handle card //event dialogs, mask off the events this //activity should handle //i.e. CardEmu.HANDLE_CARD_TRANSACTING|CardEmu.HANDLE_CARD_TASK // //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 com.simplytapp.sdkdependants.ActivityType.java: public class ActivityType extends Activity { } or 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: @Override protected PinInterface getPinInterfaceSetting() { //set the pin interface here return new PinDialogs(); } Configuring XMLYou may need to change the name of the main card payment activity below from com.simplytapp.sdk.CardEmuActivity to the one you choose. AndroidManifest.xml: <uses-sdk android:minSdkVersion="19" 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> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="com.simplytapp.sdk.CardEmuActivity" android:screenOrientation="portrait" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <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" /> </intent-filter> </activity> <activity android:name="com.simplytapp.oauth.PrepareRequestTokenActivity" android:launchMode="singleTask"> <intent-filter> <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" /> </intent-filter> </activity> <service android:name="com.simplytapp.virtualcard.ApduService" android:exported="true" android:permission="android.permission.BIND_NFC_SERVICE"> <intent-filter> <action android:name="android.nfc.HostApduService"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <meta-data android:name="android.nfc.HostApduService" android:resource="@xml/aid_list"/> </service> </application> tell the service which AIDs to respond to. <host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android" android:description="@string/servicedesc"> <aid-group android:description="@string/paymentGroup" android:category="payment"> <aid-filter android:name="325041592E5359532E4444463031" android:description="@string/ppse"/> <aid-filter android:name="A0000000041010" android:description="@string/MasterCard"/> <aid-filter android:name="A0000000031010" android:description="@string/Visa"/> <aid-filter android:name="A0000002771010" android:description="@string/Interac"/> </aid-group> </host-apdu-service> values/strings.xml: <resources> <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> </resources> |