Cards Being Added or Removed Notifications
loadCards method initiates loading of available card credentials from the remote server. This method is non-blocking and can be called anywhere in your activity:
loadCards();
When card loading completes, it triggers a callback to cardsLoaded method:
@Override
protected void cardsLoaded(ArrayList<CardDetails> cardList, boolean finishedLoading) {
// may want to store these card credentials statically
if(finishedLoading &&
(cardList==null || cardList.size()==0))
{
//here is where you would push the user to a URL to add a card credentials to this app!
}
else
{
//here is where i would receive my list of card credentials to display
}
}
cardsRemoved method is triggered when the SDK libraries is refreshing the list of card credentials and is indicating to the activity to remove them from GUI
@Override
protected void cardsRemoved() {
//may want to remove cards from static locations
}
Setting Active Card and PIN
These methods are called when the SDK sets the application PIN or sets the card credential that is active.
Your application may want to keep up with these values in the event the application needs to close or be restarted on the operating system.
@Override
public void setPin(Pin pin)
{
//do something with this pin
//
super.setPin(pin);
}
@Override
public void setActiveCard(Card card)
{
//do something with this active card
//
super.setActiveCard(card);
}
Messaging and Notifications from SDK libraries
Get a message from the card that the user must provide and answer to.
@Override
public void postCardMessageGetApprovalWithData(String cardId, String msg,
VirtualCard card, ApprovalData approvalData) {
}
The answer should be returned back to the user with VirtualCard.messageApproval() method.
//an example of setting a password back to the card
String password = "myPassword";
Object ad = approvalData.getApprovalData();
if(ad.equals(ApprovalData.StringData.class))
{
ApprovalData.StringData sd = (ApprovalData.StringData)ad;
sd.setAnswer(password);
}
card.messageApproval(true,approvalData);
These methods are called during notifications from the cards to this Activity:
@Override
public void cardProcessNotifications(Card card, short msg) {
super.cardProcessNotifications(card, msg);
//may want to handle notifications here
}
@Override
public void cardMessages(Card card, Message msg) {
super.cardMessages(card, msg);
//may want to handle card messages here
}
When calling api's to SimplyTapp, these methods will trigger upon API reponses
@Override
public void apiCallError(IOException e, ApiCall apiCall) {
super.apiCallError(e, apiCall);
//may want to handle api call errors here
}
@Override
public void apiCallReturned(ApiCall apiCall) {
super.apiCallReturned(apiCall);
//may want to handle api call returns here
}
Configuration Methods (discussed in previous section)
@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
return 0x00;
}
@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();
}
@Override
protected PinInterface getPinInterfaceSetting() {
//set the pin interface here
return new PinDialogs();
}