Package
- Artifact:
africa.sudo:cloudcard - Version: 0.2.0
- Entry point:
CloudCardAndroid
Overview
The Cloud Card Android SDK provides APIs for:- Card provisioning and registration
- Card lifecycle management (freeze, unfreeze, delete, wipe)
- Multi-card support with active and default card selection
- QR-based transactions
- Token usage summaries and key replenishment
- NFC status checks, chip-position indicators, and payment-app settings
- Locally cached transaction history
Installation
Add the SDK repository and dependency to your Android app module setup.Keep your repository credentials in
gradle.properties or environment variables rather than committing them to source control.Android Manifest
Add the following service inside the<application> tag of your AndroidManifest.xml.
Initialization
CloudCardAndroid is a singleton. Call getInstance() once during app startup with a Context; later calls can omit it.
getInstance() calls init() internally, so you do not need to call init() yourself:
Device and NFC Checks
isNfcEnabled()
true: NFC is available and enabledfalse: NFC is available but not enablednull: NFC is not available on the device
isDeviceSupported()
true if the device meets the required security and compatibility checks.
isDefaultPaymentApp()
true if your application is currently set as the default contactless payment app.
launchDefaultPaymentAppSettings(activity: Activity)
true if the settings page was launched.
NFC Chip Position
These helpers show users where to tap on the device for contactless payments.showNfcChipPosition(activity, duration, colorHex)
activity: activity used to display the overlayduration: display time in milliseconds. Passnullto show it indefinitelycolorHex: optional indicator color, for example"#FF5722"
true if the indicator was displayed.
hideNfcChipPosition()
false if no indicator was showing.
getNfcChipPosition()
null if the position cannot be determined.
Card Registration
registerCard(data: RegistrationData)
Card Management
getCards()
setActiveCard(id: String)
tokenUniqueRef as the active card used for the next payment.
setDefaultCard(id: String)
tokenUniqueRef as the default card used for payments.
setActiveCard and setDefaultCard are relevant when the SDK is initialized with supportMultipleCards = true.freezeUnfreezeCard(period: Duration?, cardId: String)
period: optional duration for which the card should stay frozencardId: required card identifier
CCResult whose data field is a Boolean representing the latest card state.
deleteCard(cardId: String)
emptyWallet()
wipeWallet()
Tokens and Security
manualKeyReplenishment()
tokenSummary()
getTokenThreshold()
tokenSummary() to decide when to call manualKeyReplenishment().
setRequireAuth(auth: Boolean)
true to enforce foreground card access and a biometric check before transactions.
QR and Transactions
getEmvQr(...)
cardId: required card identifieramount: transaction amount in the lowest denomination, as a 12-character zero-padded string. For example, NGN 1 is"000000000100". Leave it empty ornullto generate a dynamic-amount QRforegroundColorHex: QR code color. Defaults to blackbackgroundColorHex: QR background color. Defaults to transparentmargin: margin between the QR code and its background. Defaults to4
CCResult whose data field contains a Bitmap.
getSavedTransactions()
Objects
RegistrationData
Required fields:
walletId: institution IDpaymentAppInstanceId: unique device IDaccountId: card unique identifierjwtToken: auth token from your server
secret: secret passed to the usercardNumber: card number for an already-issued cardexpiryDate: expiry for an already-issued cardcardHolderName: cardholder name for an already-issued card
CCResult
Fields:
status: request status. Possible values areSUCCESS,FAILED,PENDINGmessage: accompanying messagedata: present on successful responses
CardData
Fields:
isActive: current card state.falsemeans the card is frozenid: unique card IDmaskedPan: masked PANcardHolder: cardholder nameexp: card expiry data
NfcChipPosition
Fields:
x: horizontal coordinate of the NFC chipy: vertical coordinate of the NFC chipconfidence: confidence level of the detected position
SavedTransaction
Fields:
amount: transaction amountcurrency: transaction currencytimestamp: time the transaction completedtype: transaction type
Customization
APDU Service Banner
To override the default Host APDU Service banner used by the library, add a drawable resource with the same name in your application:- Create
cloud_card_bannerin your app’sres/drawabledirectory.
