There are both iOS and Android mobile client applications that work with the Token Vending Machine (TVM) demo service. These are bundled with the Amazon iOS and Android SDKs, which you can download from here (iOS) and here (Android). Once you've installed the Eclipse ADT (for Android) and Xcode on MacOS (for iOS), all you have to do is make sure that you configure the apps to point to the URL where your TVM service is running - which, if you're following along with these blogs, will be in the cloud on the CloudBees PaaS. The two files to look for are AwsCredentials.properties for Android (note that this is a bit of a misnomer - the actual AWS credentials aren't stored on the device at all) and Constants.h for the Objective-C iOS build. Here are a couple of screenshots that show the location of these files, but it's easy to find them using the respective IDEs:
Here's what the home screens for both Android and iOS clients should look like: they aren't identical, although they have some features in common.
If you haven't configured the AWS credentials properly in the Android or iOS client applications, then you'll see the following error messages when you start the app on your device or simulator:
Here is a reminder of what you should put in the AwsCredentials.properties (for the Android client) and/or Constants.h (for the iOS client) - these need to match the URL on which you are running the TVM service (aws-cb-tvm-..cloudbees.net) and for the Identity TVM only, the application name that you passed to the TVM service as "PARAM1": for these examples, I am using "aws-cb-tvm-demo " for both the iOS and Android clients. Remember that the TVM client and service use these addresses to form a hash for the records that the Identity TVM stores in an SDB domain - if you see errors when trying to register or login, this is the likely culprit, so double-check your configurations carefully.
Anonymous TVM - Android (AwsCredentials.properties)
Anonymous TVM - iOS (Constants.h)
#define TOKEN_VENDING_MACHINE_URL @"aws-cb-tvm-anonymous.mqprichard.cloudbees.net"
#define USE_SSL NO
Identity TVM - Android (AwsCredentials.properties)
Identity TVM - iOS (Constants.h)
#define TOKEN_VENDING_MACHINE_URL @"aws-cb-tvm-identity.mqprichard.cloudbees.net"
#define APP_NAME @"aws-cb-tvm-demo"
#define USE_SSL NO
The key difference between the Anonymous and Identity TVM services is that the latter uses an AWS SimpleDB database to store user/password credentials, which are used to control login to the client and with it, access to the AWS services. The former allows anonymous access and simply records the mobile device's UDID (unique device identifier). That means the Identity TVM provides two additional services (these are interactive servlets, accessed via the mobile device's browser) that allow the user to register a new username/password or login with an existing one. Here's the registration sequence for the Identity TVM on both Android and iPhone:
So all the setup is now complete and you should be able to access the TVM demo client application using the Android or iOS simulator. If you want to push it out to a real device, that's easy too. Take a look at this blog for an example of how to use the CloudBees Jenkins Continuous Integration service with Zubhium to do an automatic Android build and push; for iOS (iPhone/iPad/iPod Touch), you can use TestFlight or Appaloosa to push to the device and this blog has all the details. In the final blog in this series, I will give a few examples of some interesting things you can try with this example.
Mark Prichard, Senior Director of Product Management
Mark Prichard speaks and blogs regularly as an evangelist for CloudBees and Platform as a Service. He came to CloudBees after 13 years at BEA Systems and Oracle, where he was product manager for the WebLogic Platform. A graduate of St John's College, Cambridge and the Cambridge University Computer Laboratory, Mark works for CloudBees in Los Altos, CA. Follow Mark on Twitter and via his blog Clouds, Bees and Blogs.
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.