Appstore Blogs

Appstore Blogs

Want the latest?

appstore topics

Recent Posts

Archive

Showing posts tagged with Mobile App SDK

April 23, 2013

derekgeb

Mad Menace Games is the creator of the popular game GraveStompers: Zombie vs Zombie. GraveStompers is a console-style 3rd person shooter with intuitive touch-screen controls in which zombie eradication has never been more exhilarating. One way Mad Menace monetizes their game is through the Amazon In-App Purchasing API to allow users to purchase Ghostface, the villain from the Scream movies. Since the game is built using the Unity game engine, Mad Menace Games uses the free Amazon In-App Purchasing API plug-in for Unity to support their monetization strategy. According to Michael Stragey, GraveStompers lead developer, the Unity plug-in made it extremely easy to accomplish this and release their game on Amazon. In this post, we look at the following 4 steps used by Mad Menace Games for supporting an entitlement in-app purchase in Unity:

  1. Setting up the Amazon In-App Purchasing Unity plug-in and test environment
  2. Launching the Amazon purchase flow
  3. Handling the result of the Amazon purchase flow
  4. Determining if the user previously purchased the entitlement

Step 1: Setting up the Amazon In-App Purchasing Unity plug-in and test environment

To start off, Mad Menace Games had to install and setup the Amazon In-App Purchasing Unity plug-in. To do this for your app, with your Android game open in Unity, you add the Amazon plug-in and support for In-App Purchasing to your environment by completing the following steps:

  1. Right click on Project Pane
  2. Select “Import Package/Custom Package…”
  3. Select the “AmazonIAP.unitypackage” that was downloaded as part of the Amazon Mobile App SDK and click “Open”
  4. From the import dialog click “Import” and this package will be added to your project
  5. Select the “Amazon” menu
  6. Click “Generate AndroidManifest.xml file”
     

There is only one more setup task now that the Unity environment has Amazon In-App Purchasing available and the application specifies this support in its manifest. As a developer, you need to set up your sandboxed test environment for running in-app purchasing transactions. This means you install the AmazonSDKTester.apk from the Amazon Mobile App SDK on your emulator or device and provide a JSON file detailing your IAP items. More details on setting up your test environment can be found here.

Step 2: Launching the Amazon purchase flow

With setup now complete, let’s take a look at the more exciting stuff. After installing the plug-in, Mad Menace Games added the code for supporting the sale of their character “Ghostface”. The first step is to add the code for launching the Amazon purchase flow UI when the user wants to buy the character. This can be easily done with the following code:

AmazonIAP.initiatePurchaseRequest("com.gravestompers.characters.ghostface");

The string “com.gravestompers.characters.ghostface” is the SKU of the Ghostface IAP item specified on the Mobile App Distribution Portal along with being defined in the JSON file for testing. These places are where you also specify things such as the type of in-app item (consumable, entitlement, or subscription), price, title, and description.

Step 3: Handling the result of the Amazon purchase flow

Now with the purchase flow being in place and the user actually able to make a purchase, code is required for handling the result of the purchase flow and providing the user with the actual Ghostface character. The response for this purchase flow will be returned via the AmazonIAPEventListener methods: purchaseFailedEvent and purchaseSuccessfulEvent. Below is an example of what Mad Menace Games’ code may look like for this.

void purchaseFailedEvent( string reason )

{

      // Log the reasons for failure

      Debug.Log( "purchaseFailedEvent: " + reason );

}

 

void purchaseSuccessfulEvent( AmazonReceipt receipt )

{

      // Store receipt and verify it is legitimate with Amazon Receipt Verification Server

      storeAndVerifyReceipt( receipt );

      if (receipt.sku == "com.gravestompers.characters.ghostface")

            unlockGhostfaceChacter();

}

As a best practice, we recommend validating the receipt you receive from a successful purchase via your server that stores these receipts. More information on validation of receipts can be found here.

Step 4: Determining if the user previously purchased the entitlement

After creating a fully functioning purchase experience, there was one final coding task Mad Menace Games had to complete. Once a user owns this character, they should be able to access the character if they uninstall and reinstall the app, clear their app data, or change from playing the app on their phone to playing it on their Kindle Fire HD. To help make life easier for developers, Amazon keeps track of these entitlement in-app purchases. As a developer, you can receive these purchases via the AmazonIAPEventListener’s purchaseUpdatesRequestSuccessfulEvent method. This method will be called anytime there are new entitlements the running app needs to process. Below is an example code snippet:

void purchaseUpdatesRequestSuccessfulEvent( List<string> revokedSkus, List<AmazonReceipt> receipts )

{

  // Process New Receipts

  foreach ( AmazonReceipt receipt in receipts )

  {

   // Store receipt and verify it is legitimate with Amazon Receipt Verification Server

      storeAndVerifyReceipt( receipt );

      if (receipt.sku == "com.gravestompers.characters.ghostface")

        unlockGhostfaceChacter();

  }

}

That is all it took for Mad Menace Games to add Amazon In-App Purchasing support to their GraveStompers Unity game. You can find more information on Amazon In-App Purchasing and the Unity plug-in here.

March 27, 2013

obeida

At Amazon, we are always looking to make your experience developing Kindle Fire apps as easy as possible. We have two new tools to help:

Faster Device Emulation with New x86 System Images

Like most developers, you’ve probably sat around waiting for the emulator to start up, or you’ve found the experience of emulated apps slow to use. Although we believe it’s always better to use an actual Kindle Fire tablet to debug your apps, we understand that developers may need to use the emulator to test app compatibility. Wouldn’t it be nice if emulators weren’t so slow? 

  • The Kindle Fire emulator loads and runs faster: emulator startup and run time with the x86 system images is now close to that of an actual Kindle Fire tablet
  • It also looks and acts the same: If you’ve used our standard ARM system images before, there’s no change in how you use the new x86 system images

To demonstrate how much faster the new x86 images are, we used Air Patriots, a game from Amazon Game Studios, with lots of code and lots of assets. We ran it on the Kindle Fire HD emulator in different configurations, as well as on an actual physical Kindle Fire HD. The result? Faster startup and response time for the emulator, and the game play was nearly identical to that of a tablet. Here are the stats:

Kindle Fire HD emulator configuration on reference development computer

Time from app launch to accept user input

ARM system image, without using host GPU

2:50

ARM system image, using host GPU

0:52

x86 system image, without using host GPU

0:36

x86 system image, using host GPU

0:23

Kindle Fire HD tablet

0:17

* Our x86 system image using a development computer running Windows 7 with a quad-core 3.10 GHz processor, 8 GB of memory, and AMD/ATI Radeon R6570 graphics.

To get the x86 system images for Kindle Fire, you can simply follow our instructions for setting up the Kindle Fire developer tools. There is no new or additional installation required. The x86 system images offer improved performance, especially when the experimental GPU emulation is enabled.

Easier API Adoption with the Amazon Mobile App SDK Eclipse Plugin

Since we introduced the Amazon Mobile App SDK Eclipse Plugin, we’ve received feedback that it really does speed up the time and effort it takes developers to adopt Amazon APIs. Today, the Eclipse plugin is out of beta. If you have not seen the plugin in action, check out our demo video:

Talk to Us

Questions? Comments? Feedback? Tell us about your experience with the x86 system images and Eclipse plugin, in our forums.

Abu Obeida Bakhach is a product manager for the Kindle Fire developer tools and publications team, where he thinks of ways to make developers lives creating apps as simple as possible. Previously, he was at Microsoft in developer platform evangelism growing the Windows 8/phone ecosystem with open source frameworks. In his spare time, he keeps himself busy catching with his three children on cycling trips.

 

January 21, 2013

Amazon Mobile App Distribution Program

Today we released a new tool to help you integrate Amazon APIs into your Android apps. The AmazonMobile App SDK Eclipse Plugin (beta) allows you to rapidly and reliably integrate Amazon APIs into your Android projects, speeding up development and cutting down on project setup time.

The Amazon Mobile App SDK Eclipse Plugin (beta) is a design-time tool that is easy to install, simple to control, and builds on your familiarity with Eclipse to increase your productivity in developing apps and games for distribution on Amazon. The plugin generates the appropriate config entries for the APIs you select, then copies over the relevant API jar files. If desired, you can also use it to quickly undo API integration, without affecting the original state of your Eclipse project.

Eclipse-1new

Benefits of Using the Amazon Mobile App SDK Eclipse Plugin:

  • Free to use: As with other resources we make available, the plugin is free for developers distributing their apps on Amazon.
  • Easy to use: Developers have indicated that it is surprisingly fast to deploy and use the plugin. The deployment of this tool follows the typical Eclipse plugin download and installation experience and does not require a new usage paradigm.
  • Gives you control of APIs and versions: The plugin allows you to use the latest version of the APIs in the Amazon Mobile App SDK that you have on your system and will alert you if your project is using an older version of the APIs.
  • Works for all apps and games: The plugin helps you to quickly develop any Android app that you plan to offer via the Amazon marketplace, including Kindle Fire tablets and Android smartphones.

What’s Next?

Click here to learn how to install the Amazon MobileApp SDK Eclipse Plugin. Take it for a spin, add it to your toolbox, and then tell us what you think by completing this brief survey. We welcome your feedback and appreciate learning what more we can do to help increase your productivity.

 

Want the latest?

appstore topics

Recent Posts

Archive