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:

@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: