No results found

Try a different or more specific query
Developer Console
Amazon Developer Blogs

Amazon Developer Blogs

Showing posts tagged with Kindle Fire

October 17, 2013

David Isbitski

Excited about the new Kindle Fire tablets?  Can’t wait to get your hands on them to run your app?  We are happy to announce the emulators for Kindle Fire HDX 8.9”, Kindle Fire HDX 7” and Kindle Fire HD 7”.  For a smooth and quick experience to create and configure AVDs (Android Virtual Devices), we are also announcing the beta Amazon AVD Launcher.

Just how fast?

Via Abu Obeida Bakhach, Kindle Developer Programs Product Manager…

“Let’s be clear, Android emulators have a bad reputation. They are slow to start and use. Keeping that in mind, running the x86 system images with a capable GPU and the right virtualization options, you can run apps at near-device speed. But speed alone isn’t enough. We have built the third-generation emulators directly from Fire OS source code to provide the most accurate Kindle Fire emulation.

With Kindle Fire HDX sporting best-in-class hardware, providing true-to-device emulation requires a development machine with an equally solid graphics configuration. Both x86 and ARM system images take full advantage of the GPU. However, the optimal emulation experience is through x86 system images.

To demonstrate how much faster the x86 system images are than the ARM system images, we looked at the performance of Air Patriots, a game from Amazon Game Studios. This is a 74-MB APK that includes complex gameplay code along with a large set of assets. We ran the game on the Kindle Fire HDX 7” emulator, as well as on an actual Kindle Fire HDX 7” tablet.  We hosted the emulator on a Windows 7 machine with a quad-core 3.10 GHz processor, 8 GB of memory, and AMD/ATI Radeon R6570 graphics card.

The result? Fast startup and response time for the x86 system image. The gameplay was nearly identical to that of the tablet.” 

Here are the stats:
 


 

Getting Started

You should first set up the x86 system images for the Kindle Fire emulator as a faster alternative to ARM-based emulation, if your development computer running Windows or OS X has an Intel processor that supports virtualization extensions (VT-x). To determine the capabilities of your Intel processor, visit http://ark.intel.com/.

Typically, the better the overall processor performance, the better the emulator performance.  The performance of an x86 system image can be comparable to a physical Kindle Fire tablet when the emulator is running on a development computer that has a sufficiently capable processor and GPU. Using an x86 system image eliminates the translation of ARM to x86 instructions that occurs at runtime when using the ARM-based emulator.

You can read the full documentation on Setting up Intel® Hardware Accelerated Execution Manager (Intel® HAXM) here.

If you have any issues downloading through the Android SDK Manager here is a direct link I have found helpful in my own installations.

I am using a Macbook Air for this blog post but all of the Intel HAXM drivers and Android AVD work just as well on Windows.
 




Once you have the HAXM drivers successfully installed you will need to make sure you check of Intel x86 support for each API Level/Kindle revision you want to use.  This is done through the Android SDK Manager like you would for any other Android Emulator image.

 


 

You will know that the x86 hardware emulation is successfully running when you first start one of the new emulators as seen below.
 


 

Choosing the correct Kindle Fire Images in the Android SDK Manager

Once you have the Intel HAXM driver installed and working correctly you will need to download the Kindle Fire Images from the Android SDK Manager by following the directions in the Setting Up Your Development Environment faq.

Be sure to select the appropriate Kindle generation under the corresponding Android API Level.  For example, the new Kindle Fire HDX’s are the third generation of Kindle Fire devices and support Level 17 of the Android API.

Android 4.2.2 API 17:

  • SDK Platform
  • ARM EABI v7a System Image (emulator prerequisite for ARM system images)
  • Intel x86 Atom System Image (emulator prerequisite for x86 system images)
  • Kindle Fire HD 7" (3rd Generation) (ARM and x86 system images for emulator)
  • Kindle Fire HDX 7" (3rd Generation) (ARM and x86 system images for emulator)
  • Kindle Fire HDX 8.9" (3rd Generation) (ARM and x86 system images for emulator)

Also, do not forget the Extras section as I have seen some developers miss the Kindle Device definitions specifically, which will result in blank entries in the Amazon AVD Launcher.

  • Extras:
    • Kindle Fire Device Definitions
    • Kindle Fire USB Driver (not applicable for OS X)
    • Android Support Library
    • Intel x86 Emulator Accelerator (HAXM) (emulator prerequisite for x86 system images)
    • Amazon AVD Launcher

Running the new Amazon AVD Launcher

Now that we have full Intel x86 image support and working Kindle Fire Images form the Android SDK we need to set up the Amazon AVD Launcher.  You can read the installation faq here for step by step instructions.

The Amazon AVD Launcher tool simplifies the process of creating an Android Virtual Device (AVD) by allowing you to select the device you want to emulate and automatically filling in the correct settings.  As a result, the Amazon AVD Launcher is a more reliable way of configuring the emulator than manually configuring it with the Android AVD Manager.

You will find the new Amazon AVD Launcher executable in the Android sdk/extras/Amazon/ folder of your local Android SDK installation.  Upon running it for the first time you will be treated to a graphical list of all the Kindle Fire Images you have installed and their associated specs as seen below.
 


 

Click the Create AVD button or switch over to the Amazon AVD tab and select New to create a new image.  You will notice the options are much more streamlined now and selecting the appropriate Kindle Fire image will automatically set all of the options for you.  No more guess work!
 


 

You can name the new AVD image whatever you chose.  Make sure that you have the Intel x86 image support selected and that Host GPU is clicked.
 


 

I also recommend clicking on the Advanced Options tab and selecting both My Computer Keyboard for Keyboard and Webcam (Webcam0 for my Macbook Air as seen in the screenshot) for the front camera.  This will be sure to use your computer’s keyboard instead of software emulation as well as its webcam
 

 

You can leave all of the Memory settings at the default levels they have already been set to the most optimized for the image automatically.  You can then start the image by clicking the Start button in the Amazon AVD Launcher and will be greeted with a couple of launch options, mostly associated with how you want to fit the emulator on your screen and the ability to wipe the virtual machine’s data.
 


 

Congratulations, you now have a fully functional Kindle Fire image running at hardware-virtualized speeds!
 


 

Do not forget if you are using an existing code base to change your target emulator from your previous AVD to the new Amazon AVD image you have created as seen below.
 


 

Conclusion

We found that 80% of developers ran into trouble using the Android Virtual Device Manager to create, configure and launch AVDs.  Instead of fiddling with build targets, guessing API levels, RAM and other settings, we know you want to instantly create and launch an emulator and just focus on developing and testing your app.

At Amazon, we believe that granting developers a choice of tools ensures a more flexible and productive mobile development experience. By preserving the Android definition of an AVD, the Amazon AVD Launcher is fully compatible with the Android Virtual Device Manager, allowing Kindle Fire AVDs created by either tool to be launched on the other.

Warning: Once we loaded games on emulators with the right GPU emulation and x86 system images, we had problems pulling away testers hooked on playing at device-like speed!

Please provide feedback at kindle-sdk-beta@amazon.com or the Kindle Development Tools forum.

 

-Dave (@TheDaveDev)

 

August 14, 2013

Mike Hines

We’ve gotten a few questions recently about Adobe AIR support on Kindle Fire. Here is the quick FAQ:

Do Kindle Fire devices have Adobe AIR embedded?

Yes.

The Original Kindle Fire has Adobe AIR 2.7.1 embedded as a Shared Runtime. The Kindle Fire, Kindle Fire 7” HD, and the Kindle Fire 8.9” HD devices (the Kindle Fire devices running ICS) all have Shared Runtime support for Adobe AIR 3.1.

Can I use a newer version of AIR for my app?

Yes.

The current version of Flash Builder includes support for Captive Runtime, a way that you can package the most recent version of Adobe Air with your app. Everything you app needs to run is packaged directly into the apk. Note: The ADT –package command is now packaging AIR 3.7 and higher as a Captive Runtime by default. See this note from Adobe for more details.

Does Kindle Fire have any Adobe AIR Native Extensions (ANEs)?

Yes.

We have two free Adobe AIR Native Extensions for the Kindle Fire. One for In-App Purchasing, and another for GameCircle integration. You can read the press release here.

 

August 08, 2013

Peter Heinrich

Mobile app and game developers are no strangers to working in the cloud, which is why Amazon has added a dedicated Mobile and Gaming Track to its AWS re:Invent conference this year. Held November 12-15 in Las Vegas, AWS re:Invent will offer dedicated sessions and a special bootcamp tailored to mobile app and game developers like you. Register early as the conference sold out last year!

Deep dive technical sessions and hands-on labs will teach you how to scale your mobile app or game on the AWS cloud, distribute on Amazon, reach millions, increase user engagement and monetization, and more. You’ll also have the opportunity to meet Amazon teams in person, get one-on-one support, and attend a special reception.

Technical sessions during the main conference will focus on AWS features and services that speed mobile development and increase your audience. You’ll also learn how to get the most from Kindle Fire hardware without sacrificing compatibility on other mobile devices. Developer case studies will explain the tips and tricks they used to successfully monetize their apps and games. Here’s a sample of sessions to be offered:

A pre-conference bootcamp will dive even deeper, with a full day of intensive instruction and live coding with the Amazon APIs, including GameCircle, A/B Testing, In-App Purchasing, and Mobile Ads. Starting with design patterns common to Games-as-a-Service and deployment to AWS, this workshop will move on to the specifics of implementation, publishing on the Amazon Appstore, and how to market your application or game on Amazon.com and Kindle Fire devices.

Join us in Las Vegas this November for the dedicated Mobile and Gaming track at AWS re:Invent 2013.

 

August 06, 2013

Mike Hines

Starting today, you can submit your web apps and mobile optimized web sites and have them merchandised alongside native apps on Amazon and Kindle Fire in nearly 200 countries worldwide, without any third-party software or doing any native app development. Amazon Web App Resources (http://developer.amazon.com/webapps) provides the tools that you need to optimize your web apps for Kindle Fire and Android devices to sell them in our store, including powerful tools to help you test and debug your web apps and monetize using Amazon’s In-App Purchasing API for JavaScript. Plus, we’ve made sure your web apps achieve native-like performance on Kindle Fire with our new fast web runtime, based on the Chromium engine.

Rialto

Tools

To make sure your web app works great on Kindle Fire and Android devices, you can use the Web App Tester, which you can get from our store here. The Web App Tester allows you to test your web app in a production-like environment before submitting it to Amazon, and offers a suite of tools to help with on-device debugging of your web apps, ensuring that they’ll work great on Android and Kindle Fire.

We’ve also created and made available the Amazon In-App Purchasing API for JavaScript, allowing you to easily build sales of digital goods like gems, level unlocks, and subscriptions into your web apps.

Kindle Fire web runtime

Kindle Fire’s web runtime is based on the open source Chromium project, and is GPU-accelerated and optimized for fluidity to make sure your web apps run smooth on Kindle Fire, just like a native app. The new runtime supports the latest HTML5/web features and includes standards-based extensions that give you access to offline storage and location sensors. Read more about the updated web app runtime here.

Get started today

Web developers with HTML5 apps and mobile-optimized web sites can easily get started at the Amazon Mobile App Distribution Portal. Once you’re logged in, go to “My Apps”, hover over the green “Add New App” button and click “Add new Web App”.  More information on how to prepare and submit your web apps is available here.

July 23, 2013

Peter Heinrich

Save game data in the cloud to protect your customers’ progress and support play from multiple devices

In just a few short years, the explosion in popularity of smart phones and tablets has transformed gaming, as touch controls, geolocation, and micropayments enter the mainstream. Online storage is also becoming more common, as developers adjust to a major challenge of mobile devices: physical durability. Keeping your data in the cloud starts to look mighty attractive compared to keeping it on a device that’s easily misplaced, damaged, or stolen.

Blob storage is a common way to save data online (game data is simply written to the cloud as one big chunk). If two devices update the same data, though, one of the updates must be ignored or overwrite the other. You have to decide which update to keep (based on a timestamp or version number, perhaps), or maybe prompt the user to choose between them. Either way, data is lost.

Because of the overhead involved, many developers don’t even bother with this naïve approach. This is a huge disservice to the player, whose game progress is completely lost if anything happens to his or her mobile device. Whispersync for Games saves game data for you, and works across all Android devices (including Kindle Fire).

Mergeable and Non-mergeable Data

Whispersync was designed to prevent data loss, make developer or player intervention unnecessary when resolving conflicts, and be dead-simple to integrate and use. It doesn’t distinguish between online and local storage, so the programmer doesn’t have to handle separate cases for saving to disk and cloud. It does this by manipulating only mergeable data.

Game data is mergeable if a simple rule can be defined to resolve conflicting values. For example, the rule associated with the best completion time might be, “Take whichever value is smallest.” To keep track of a player’s best score, we might use, “Take whichever value is highest.” In some cases, the most recent value may be the most important, so the appropriate rule would be, “Take whichever value is newest.” These rules apply at a granular level; Whispersync doesn’t treat game data as one big chunk.

Not all game data can be resolved using simple rules, though, in which case we call it non-mergeable. The current state of a chess board, for example, requires a complex tree structure to describe it. Reconciling two versions of the board is more complicated than just choosing the “lowest” or “highest” one.

Describing Game Data Using Syncable Types

Fortunately, a lot of game data is naturally mergeable or can be adjusted to be so. Whispersync offers many different syncable types with several built-in rules to resolve conflicts. They can be used to model simple and complex game data.

  • SyncableNumber – A number that is the lowest, highest, or most recent.
  • SyncableString – A string that is the most recent.
  • SyncableAccumulatingNumber – A number that can be incremented and decremented.
  • SyncableNumberList – A list of numbers in ascending, descending, or latest order.
  • SyncableStringList – A list of strings ordered by most recent.
  • SyncableStringSet – A set of strings.
  • GameDataMap – A nested map, allowing hierarchical data.

A global GameDataMap object represents the root storage for your game, storing named values of the types above. Setting a value that doesn’t exist will create it on the fly. The accessor used to retrieve a value determines the conflict resolution strategy that will be associated with it.

  public static final String SKILLS = "skills";
  public static final String TOTAL_TIME = "totalTime";

  public static final String LEVEL_MAP = "levelMap";

  public static final int NUM_LEVELS = 5;
  public static final int MAX_ITEMS = 3;

  public static final String SCORE = "score";
  public static final String STARS = "stars";
  public static final String BEST_SCORES = "bestScores";
  public static final String BEST_TIMES = "bestTimes";

  GameDataMap gameDataMap;

  public void initGameData() {
    gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // These will be independent of level.
    gameDataMap.getStringSet(SKILLS);
    gameDataMap.getAccumulatingNumber(TOTAL_TIME);

    // Use nested maps to establish some per-level values.
    for (int i=0; i < NUM_LEVELS; i++) {
      GameDataMap levelMap = gameDataMap.getMap(LEVEL_MAP + i);

      // Each level will have its own copy of these values.
      levelMap.getLatestNumber(SCORE);
      levelMap.getHighestNumber(STARS);
      levelMap.getHighNumberList(BEST_SCORES).setMaxSize(MAX_ITEMS);
      levelMap.getLowNumberList(BEST_TIMES).setMaxSize(MAX_ITEMS);
    }
  }

In the example above, we use initGameData() to establish the structure of the data we’ll synchronize, even though we don’t actually set any values. (It can be helpful to define the data layout in one place like this, even if it’s not strictly required.) The code effectively says,

  • There will be a global set of strings called SKILLS. It will track every string added to it (strings may not be removed).
  • There will be a global running total of time in the game called TOTAL_TIME. It will accumulate deltas submitted from all devices used by a single player.
  • There will be NUM_LEVELS nested maps, each of which will have its own set of values:
    • SCORE will always reflect the last score submitted for that level.
    • STARS will always reflect the maximum stars attained for that level.
    • BEST_SCORES will always list the MAX_ITEMS highest scores for that level.
    • BEST_TIMES will always list the MAX_ITEMS fastest times for that level.

Updating and Retrieving Game Data

Whispersync abstracts all game data persistence, so we can update or retrieve values using simple getters and setters. We don’t have to worry about managing a network connection, saving to disk or the cloud, or reconciling local and online versions of variables we have in memory. When we add to the running total of time played, for example, Whispersync automatically saves the delta to disk and updates the cloud if connected. If the player’s device is currently offline, the update will be queued and delivered later.

  public void updateTotalTime(int timePlayed) {
    SyncableAccumulatingNumber totalTime = gameDataMap.getAccumulatingNumber(TOTAL_TIME);

    // Add the time played to the running total.
    totalTime.increment(timePlayed);

    // Output the new total to the console.
    System.out.println("Total Time Played = " + totalTime.asInt());
  }

Likewise, we can record skills as the player masters them and easily iterate over the set to display the ones learned so far:

  public void learnSkill(String skill) {
    SyncableStringSet skillSet = gameDataMap.getStringSet(SKILLS);

    // Add the new skill to the player's repertoire. Note that this list

    // can only expand; strings cannot be removed.
    skillSet.add(skill);

    // Output all skills to the console.
    for (SyncableStringElement s : skillSet.getValues()) {
      System.out.println("Skill = " + s.getValue());
    }
  }

Updating numbers and number lists is just as straightforward, so persisting all of the player’s progress at the completion of a level can be done in just a few lines:

  public void finishLevel(int level, int score, int stars, int time) {
    GameDataMap levelMap = gameDataMap.getMap(LEVEL_MAP + level);

    // Save the score for this level. Newer values will always overwrite
    // previous scores.

    levelMap.getLatestNumber(SCORE).set(score);

    // Try to set the new maximum stars attained on this level. If the
    // value is less than the current maximum, this call does nothing.

    levelMap.getHighestNumber(STARS).set(stars);

    // Try to add this score to the list of all-time bests. If it's not
    // high enough, this update will be ignored.

    levelMap.getHighNumberList(BEST_SCORES).add(score);

    // Try to add this completion time to the list of all-time bests. If
    // it's not low enough, this update will be ignored.

    levelMap.getLowNumberList(BEST_TIMES).add(time);
    updateTotalTime(time);
  }

The accessors on GameDataMap and Whispersync’s syncable types make it easy to manipulate game data and define how conflicts should be resolved.

Think Mergeable!

Whispersync for Games automatically resolves conflicts for data it can merge, which makes it worthwhile to describe game data using syncable types when possible. Since Whispersync supports high, low, and most recent numbers and number lists; running totals; latest strings and string lists; sets of strings; and nested maps supporting hierarchical structures, a wide range of game data can be modeled.

Thinking about your game data in mergeable terms lets you push a lot of overhead out of your code. Let Whispersync handle the heavy lifting. For more information on integrating Whispersync into your game, see the online documentation

 

July 04, 2013

Peter Heinrich

Continuing our series of success stories from developers around the world, we go to France, where developers are witnessing strong positive results less than a year after the launch of the Amazon Mobile App Distribution Program in August 2012.

Ubisoft’s PC and console titles have been available on Amazon for a long time, helping to build a great partnership between both companies over the years. As Ubisoft strengthened its mobile offering, it was a natural progression for their Android games to be made available on Amazon and to Kindle Fire users. Dominique Tardieu, Sales and Marketing Director at Ubisoft Mobile, explains: “Amazon and Kindle Fire tablets hold a significant potential for our mobile games as they become more and more widespread. Also, Amazon has developed a meaningful ecosystem for Kindle Fire games via Amazon GameCircle. This gives us the possibility to leverage the social aspects of our games, through Player vs Player functionality and leaderboards, for instance.”

Since September 2012, Ubisoft has successfully launched a variety of best-selling games on Amazon, including Rayman Jungle Run, Prince of Persia, and (more recently) Nutty Fluffies. An important element of these games’ success so far has been Amazon personalization and recommendations. Tardieu says, “The experience they bring in terms of customer relationship management and knowledge of the industry has made it possible for us to ensure a successful launch for all our titles. Amazon clearly benefits from the know-how acquired over the years working on Ubisoft’s console and PC games and has learned how to harness it to successfully promote the right content to the right consumers.”

About Ubisoft:
Ubisoft is a leading producer, publisher, and distributor of interactive entertainment products worldwide and has grown considerably through a strong and diversified line-up of products and partnerships. Ubisoft has offices in 26 countries and operates in more than 55 countries around the globe. It is committed to delivering high-quality, cutting-edge video game titles to consumers. For the 2011-12 fiscal year, Ubisoft generated sales exceeding €1 billion. To learn more, please visit: www.ubisoftgroup.com

 

July 03, 2013

Peter Heinrich

Following up on the first in a series of webinars covering Amazon devices, game services, and mobile applications, here’s a list of questions we collected during and after our presentation on Amazon Device Compatibility and Optimization.

Is it possible to test the compatibility of my existing android app with an emulator?

Yes, you can and should use the Kindle Fire emulators to test compatibility of your Android app. The Kindle Fire emulator consists of:

  • The Android emulator, which is part of the Android SDK.
  • Android Virtual Devices (AVDs).
  • Kindle Fire system images.

The Kindle Fire system images provide the additional code needed to emulate Kindle Fire tablets.

Note: We provide ARM and x86 system images for the Kindle Fire emulator as SDK add-ons. If your development computer can run the x86 system images, which are available for all tablets except Kindle Fire (1st Generation), you should use them for faster emulation. For more information, see Understanding the Kindle Fire Emulator.

How does DRM and license validation work in the Amazon store? Can we verify it’s working once the app is live?

When submitting your app, on the Binary Files tab, developers can choose Apply Amazon DRM? If selected, only customers who have purchased the app may use it. If not, your app may be used by anyone without restrictions. To test this once the app is live, sign in to the Amazon store with a different user account (or simply sign out of the Amazon store client) and try to open the app on the device. If DRM is active, your app is protected and an error will be reported.

What versions of Adobe AIR are available? When will new AIR versions become available?

The original Kindle Fire runs Gingerbread and therefore ships with AIR 2.7. The second generation Kindle Fire, including all Kindle Fire HD devices, run IceCreamSandwich and ship with AIR 3.1. Developers that need newer versions of AIR 3 in their apps can do so by leveraging captive runtime.

Is there a low-tech solution to creating a screen-size that will work for Kindle Fire and Kindle Fire HD, like 600x600?

Please see Screen Layout and Resolution for information on designing for the different Kindle Fire screen. The simplest option would be to test each layout on the Kindle Fire emulators to confirm and tweak them as necessary. See Running the Kindle Fire Emulator for more information.

When you say unsigned apk, is that the same as not exporting the apk in Eclipse?

Yes. That is correct. We are referring to an apk not built for release.

Is there a rule, or recommendation about package names in different App Stores? Can they be the same?

Yes, they can be the same.

Can I apply a signature to my app?

All applications must be digitally signed with a certificate. The default signature applied to your app is a certificate supplied by Amazon that is unique to your developer account. If your signing strategy requires that a different certificate be applied, you may do so by submitting a request using the Contact Us form. Please indicate the title of the app for which you are submitting the request.

Is the certificate different from .keystore?

Yes. The type of certificate used by Amazon to sign a developer's application is the same type generated by standard tools like keytool or jarsigner.

 

Don’t miss out next webinar event: Integrating GameCirle in Your Games on July 25th, 2013 @ 10:00 AM.

Pre-register here!

June 30, 2013

Peter Heinrich

We just released a major update to Amazon GameCircle, our free game service providing achievements, leaderboards, and Whispersync for Games. Games on all Android devices (including Kindle Fire, of course) can now integrate GameCircle, which is easy because we support Java, JNI, and Unity3D. Whether you submit your game to Amazon or Google, customers will benefit from the GameCircle experience. In addition, Whispersync has been dramatically improved, becoming the first and only cloud-save service to:

1) Automatically resolve data conflicts between mobile devices and the cloud,

2) Queue updates to support offline operation, and

3) Offer a simple interface that can be integrated in minutes.

The result: Your customers’ game data will automatically sync across devices—even if they play your game while temporarily offline—and you can concentrate on using the data instead of persisting it. You’re not locked in, though; you retain ownership and can always get a copy of the data you store.

We also give you flexibility when it comes to GameCircle display options, with no intrusive splash screen and configurable notification toasts. You’re in control and choose where they appear.

I’ll provide more technical details about these enhancements in future posts, but for now, let’s take a closer look Whispersync and explore its powerful new features and simplified interface.

Whispersync for Games

Whispersync does the heavy lifting when it comes to synchronizing local data to and from the cloud. It handles the tricky scenarios that you would normally have to deal with yourself, like conflicting updates from multiple devices or sync requests from a device that’s temporarily offline. You can also stop worrying about scalability; behind the curtain, Whispersync (and all of GameCircle) is powered by Amazon Web Services like S3 and DynamoDB.

Using Whispersync is easy through an API that has been completely redesigned, providing an interface similar to SharedPreferences. Saving game data to the cloud and synchronizing it between devices is as easy as retrieving a variable from a map and using (or changing) its value:

    // Get the global game data map for the current player.
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // Look up the object representing the player’s skill rating.
    // If none exists, one will be created.

    SyncableNumber skillRating = gameDataMap.getHighestNumber("skillRating");
    System.out.println("skillRating = " + skillRating.asLong());

    . . .

    // Update the value. As long as this device is online (or as soon as
    // it is), local and cloud storage will be synced.

    skillRating.set(MAX_SKILLRATING);

Whispersync maintains a singleton instance of GameDataMap that acts as the root of your game data. It can track numbers, strings, simple lists, and other maps, and gives you complete freedom in how you represent your game data using these basic syncable types. You add new variables simply by retrieving them by name; if they don’t exist, they’ll be created on the fly and synchronized from that point on.

How Whispersync applies updates and resolves conflicts depends on the way you access each syncable variable. For example, suppose you want to retrieve the current user’s best (highest) level across all devices:

    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
    SyncableNumber bestLevel = gameDataMap.getHighestNumber( "bestLevel" );
    System.out.println( "bestLevel = "  + bestLevel.asLong());

In this case, because “bestLevel” is retrieved as a highest number, it will always reflect the maximum value ever assigned to it, from anywhere, on any device.

String values can also be synced. You could easily set the name of the latest power-up collected:

    gameDataMap.getLatestString( "lastPowerUp" ).set("Super Boingo"); 

The syncable string associated with “lastPowerUp” will always reflect the value most recently assigned to it.

The online documentation and Javadoc included with the SDK have more information on the syncable types Whispersync supports, as well as the ways in which each may be accessed.

Practical Applications

Let me provide a few more examples to illustrate just how straightforward synchronization can be.

Recording Star Count for Several Levels

A common pattern in many games is to show stars and unlock status for each level on a level selection screen. Here’s an example of using Whispersync to track individual star values for multiple levels:

  SyncableNumber[] getLevelStars() {
     GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
     SyncableNumber[] stars = new SyncableNumber[NUM_LEVELS];

     // Get the star counts for all levels.
    
for (int i = 0; i < stars.length; i++) {
        stars[i] = gameDataMap.getHighestNumber("levelStars" + i);
     }

     return stars;
  }

The first time the score values are accessed (from anywhere), Whispersync will create entries for them in the cloud, so there’s no need to declare them ahead of time.

Accumulating a Running Total

Some progress, like coins collected or time played, represents a running total that is always updated using a delta amount. Instead of setting the value directly, you just submit the amount by which it should change. Whispersync automatically adds or subtracts this value to update the current total. For example:

 void addTimePlayedToTotal(long timePlayed) {
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();
    SyncableAccumulatingNumber totalTime =        gameDataMap.getAccumulatingNumber("totalTime");

    // This object may be incremented/decremented with long, double, and
    // BigDecimal values.

    totalTime.increment(timePlayed);
    System.out.println("Total time played: " + totalTime.asLong());
 }

Keeping a Map of Maps

By embedding a map within a map, you can create a hierarchical data structure. If your game has multiple worlds, for example, you might keep a separate GameDataMap for each one. Each of these might contain additional maps—say, one for each level.

 GameDataMap getWorldData(String name) {
    GameDataMap gameDataMap = AmazonGamesClient.getWhispersyncClient().getGameData();

    // Get all the string keys associated with top-level GameDataMap objects.
    Set<String> worldNames = gameDataMap.getMapKeys();

    // Look for a match among the maps.
    for (String currentName : worldNames) {
       if (currentName.equals(name)) {
          // A map exists for the name specified.
          return gameDataMap.getMap(currentName);
       }
    }

    // No match found. Don't create one.
    return null;
 }

Maintaining a List of Numbers

A racing game might save a player’s top three best times using a syncable number list. In this case, you could create a list for low numbers—they decrease as times improve—but you could easily choose to retain a collection of the highest or most recent values in other situations.

 // We'll initialize this once the application has launched.
 AmazonGames agsGameClient;
 GameDataMap agsGameData;
 SyncableNumberList agsBestTimes;

 // Create a callback to handle initialization result codes.
 AmazonGamesCallback agsGameCallback = new AmazonGamesCallback() {
    @Override
    public void onServiceReady(AmazonGamesClient client) {
       agsGameClient = client;
       agsGameData = AmazonGamesClient.getWhispersyncClient().getGameData();

       // Establish how many slots will be allocated and preserved.
       agsBestTimes = agsGameData.getLowNumberList("bestTimes");
       agsBestTimes.setMaxSize(3);
    }

    . . .
 };

  void finishLap(double time) {
   // Every time a lap is completed, try to add the lap time
   // to our list of best times. Only the lowest three will
   // ever be preserved.

   agsBestTimes.add(time);
 }

Every time the player finishes a lap, finishLap() would be called to update the number list. The value specified will be discarded unless it is lower than one of the current entries.

More to Come

The GameCircle improvements released in the latest update deserve more attention than the brief overview I’ve given here, so I’ll add details in the coming weeks. Look for articles dedicated to JNI; advanced API features; and using GameCircle with frameworks such as Unity3D, Cocos2d-x, and Marmalade. I’ll also dive deeper into Whispersync, discussing the difference between mergeable and non-mergeable data (and why it’s important), considerations when synchronizing currency across offline devices, and migration from the previous version. Stay tuned!

In the meantime, check out the new GameCircle release and give it a whirl. You’ll benefit whether you use the simplified Whispersync API and its expanded functionality, create a universal build to run on Kindle Fire and Android, or take advantage of the other features included with this update.

June 19, 2013

Mike Hines

I had to take a class in accounting before I understood the difference between sales and earnings. Fortunately, learning about Amazon Mobile App Distribution Program sales and earnings reporting is quite a bit simpler than that accounting class. 

While there are 7 possible reports to choose from, in this blog post, we’ll cover three popular financial reports:

  • Sales reports – show basic sales less returns over customizable time periods and countries.
  • Earnings reports – show more details (including adjustments) in a fixed one-month period.
  • Payment Reports – show you what you are actually paid every month.

Sales Reports show trends in sales and returns over standard or custom time periods. You can get daily breakdowns in CSV reports, and you can see sales broken out by individual marketplace or by the almost 200 countries in which you app could be sold. Data in sales reports are updated every few hours but do not reflect processed financial data for the current month. They do not include adjustments and other data that will affect your payment.

Below are two examples of reporting that can be customized by app and international marketplace. The first is a map view. Note the drop-down buttons for ‘Date’, ‘All Apps’ and ‘All Marketplaces’. These let you show a specific date range and show sales by marketplace (like amazon.co.uk or amazon.fr) or by the country (such as Brasil or Norway).

The next example shows a tabular view of the Sales report with detail such as Units Sold, Units Returned, Units Refunded and Gross Revenue.

Sales Report

Sales Summary

Earnings Reports represent the sales, refunds, app earnings and adjustment data used to calculate royalties earned during a given month. Data in earnings reports are released on a monthly basis once royalties earned in the previous month have been processed and approved. Monthly summary information is available in the Amazon Mobile App Distribution Portal and daily breakdowns are available through CSV export.

Earnings Report

Payment Reports represent the actual disbursement of funds from Amazon. Monthly summary information is available in the Amazon Mobile App Distribution Portal on the payment reports section.

Accessing Reports Getting these reports is easy. Log in to the Amazon Portal and click on the Reporting link (shown below). Then select the report you want, then select your customization filters below that.

(Note: of the seven reports shown in the screen shot below, all but the Beta Engagement report now allow reporting by country of sale)

Accessing Reports

The Amazon Moblie App Distribution Program gives you useful reporting data that is pretty easy to access and understand. My accounting teacher would be proud. Try getting a few reports now, and see how easy it is to get data on your apps today.

June 17, 2013

cjfrost

Some say the best developers code well because they optimize for their own laziness. They’ll invest time up front to automate a repetitive process, or extend existing code that gets them part way to where they want to be. In truth, most also struggle with the demon of NIH—Not Invented Here—because building something from the ground up scratches a programmer itch. It’s a fine line.

As the popularity of mobile devices has grown (exploded, actually) and mobile applications capture more and more eyeballs, competitive pressure is forcing more aggressive timelines. Many developers are leveraging game and application engines to speed time to market. As added benefits, these frameworks often simplify cross-platform development and reduce QA time as well.

In fact, ever since the original Kindle Fire was released in November of 2011, various game and application engines have been adding support for it. There are now several that enable building apps for Kindle Fire, can package them for the Amazon store, and provide direct support for Amazon services such as GameCircle and In-App Purchasing. I’ll list a few here and point you to more information for each, but first let’s mention their primary features and common benefits:

-          2D and 3D game development environments

Some game engines include sophisticated modeling environments that do the heavy lifting of code creation in the background, allowing you to concentrate on the story and game mechanics. They provide shortcuts to common patterns used in popular genres such as side-scrollers, puzzle games, and shooters.

-          Cross-platform simultaneous development

Engines can help you create apps for multiple platforms simultaneously, automatically generating platform-specific code as the app is designed. In many cases, all you have to think about is how your game will appear at the various screen resolutions available on different devices.

-          Ease of service integration

Most engines have plug-ins or extensions designed to allow easy integration of services like Amazon GameCircle, Insights, and In-App Purchasing. These service APIs can be pre-configured and included automatically when an engine-based project is built, so they don’t have to be added in a separate step.

Cocos2d-x (http://www.cocos2d-x.org) is a free, open-source 2D game engine based on C++. It supports multiple platforms, including Kindle Fire and iOS devices. A GameCircle extension to Cocos2d-x is included in the Amazon Mobile App SDK, simplifying integration of leaderboards, achievements, and Whispersync for Games into your Cocos2d-x projects.

For more information about our Cocos2d-x extension, see Amazon GameCircle Cocos2d-x Extension.

Corona SDK (http://www.coronalabs.com/products/corona-sdk/) is a 2D engine that allows developers and hobbyists to create games, as well as apps of other types, such as business, utility, education, productivity, etc. Using Lua, you can build and package apps for Kindle Fire, Android, iOS, and Nook using industry standards like OpenGL and Facebook APIs. Corona Enterprise SDK adds support for Objective-C and Java.

For more information about using Corona SDK with Amazon Kindle, see Signing and Building — Kindle Fire.

Unity3D (http://www.unity3d.com) is one of the most widely used and highly regarded 3D game engines for targeting mobile, web, desktop, and dedicated hardware such as smart TVs, set-top boxes, and consoles. Recently, Unity announced that Android developers can build games and apps with their engine for free. Unity includes a powerful 3D rendering environment featuring modern graphics and animation, and the Amazon Mobile App SDK includes Unity3D plug-ins to support GameCircle and In-App Purchasing.

For more about the Amazon store and Unity3D, see Amazon GameCircle Unity Plug-In and In-App Purchasing Unity Plug-In.

Many more game and application engines are available in addition to the ones listed above, some supporting Amazon services and Kindle Fire devices. Check your favorite engine for more information.

The engines are running… the green flag is up… Go!