- Notifications
You must be signed in to change notification settings - Fork2
a contribution to the mpos hackathon in berlin feb 2014
meinharrd/bitcoin-atm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project shows how the Android SDK can be included within a sample app. In this application weuse features execute transactions (CHARGE / REFUND). Those transactions are registered onlylocally. In a real world application it is highly recommended to register them from yourbackend and then look them up using the SDK. The necessary modifications are explained in comments.
TheMenuActivity
can start two activities (one each for charge respectively refund).
Each of those activities extends theMposActivity
which creates the shared provider and alsoprovides convenient methods for elementary UI actions. This makes the actual activity classesmore clear. Those activities will be discussed based on theCharge Activity
.
In theCharge Activity
the transaction processing is initiated by the user by clicking on thestart button and then we register our transaction using a transaction template. In real world, youwould ask your backend to register it, provide you with the corresponding identifier and look it up.
When the registering/lookup is finished, we connect to the accessory and initiate a check whether an update is required or notand perform it is necessary. After a succeeded update we start the transaction and handle calls ofonTransactionActionRequired(...) and onTransactionSuccess(...).
Please ensure that you have installed at least the following components using the Android SDK Manager:
- Android Studio 0.4 (or better)
- Android 4.2.2 (API 17) SDK Platform - Revision 2+
- Android Support Repository - Revision 2+
- Android Support Library - Revision 18+
You can start the Android SDK Manager within the AndroidStudio IDE:Tools >Android >SDK Manager.
In order to use this example for your application simply apply the following steps on your localmachine.
Extract the zip archive.
Import this folder using AndroidStudiohttp://developer.android.com/sdk/installing/studio.html
- Start AndroidStudio
- SelectImport Project andImport project from external model (Gradle)
- Select themPOSSampleProject folder
- When asked select:Use default gradle wrapper (recommended)
- Wait patiently(!) while the IDE starts and configures the project (this can take up to 5 minutes)
Use the
mPOSSample
run configurationNow the app should be built and installed on your Android phone or the emulator
For further usage you want to replace the already included libraries with up-to-date versions. You can examine the current used version within the menu fragment.
You can add the java doc frommPOSSample/libs via the module settings.
- During a firmware update of a card reader no processing information is shown. That doesn't mean, that the SDK is stuck.
- The app might show unexpected behaviour when confronted with screen rotations while a Dialog is shown
- The handling of
ActionResponses
is simplified