Get Started with Web Apps

You can develop HTML5 web apps to run on Fire Tablets. You have several options for structuring your web apps for the Amazon Appstore.

Options for Submitting Apps

  • packaged app: is a full-fledged client-side web standards-based application whose assets are bundled together in a ZIP archive for distribution.
  • hosted app: is an application whose assets are hosted on a web server. Clients connect to the host and download the app's assets to their device before being able to run the app.
  • HTML5 hybrid apps: are platform-native apps that use web content for the user interface.

Advantages of Packaged Apps

Packaged apps have several advantages over hosted apps:

  • Packaged apps do not require you to find a hosting solution for your app.
  • Packaged app performance can be better because all of the assets are present on the local filesystem.
  • Packaged apps can work more easily offline.

Advantages of Hosted Apps

Hosted apps have several advantages over packaged apps:

  • Hosted apps can be complete applications with server-side and client-side code.
  • Hosted apps can be updated immediately. Customers always get the latest code.
  • Hosted apps provide the same experience (and typically the same code) for customers as on your web site.

Advantages of Hybrid Apps

  • Faster, more efficient rendering, script performance, and memory management
  • Support for latest web standards (HTML5, CSS3, and JavaScript)
  • Hardware acceleration and GPU optimizations for CSS, Canvas, and WebGL graphics

You build your own wrapper with Cordova or create your own hybrid app and submit it like any other native app. For more information on Cordova, see Apache Cordova.

For information on submitting both hosted and packaged apps, see Submitting or Updating Your Web App to the Amazon Appstore.

Including the Amazon APIs

If your web app uses Amazon APIs, such as In-App Purchasing, you need to include the Amazon API JavaScript library. This library initializes any Amazon plugins and raises an amazonPlatformReady event to to signal that the APIs are ready for use. The library is hosted at the URL http://resources.amazonwebapps.com/v1/latest/Amazon-Web-App-API.min.js. To include this library, add the following <script> tag to your web app:

<script src="https://resources.amazonwebapps.com/v1/latest/Amazon-Web-App-API.min.js"></script>

Because this library raises an amazonPlatformReady event when initialization is complete, wait for the amazonPlatformReady event before you call any Amazon APIs, as in the following example:

document.addEventListener('amazonPlatformReady', function () {
    //API code goes here
});

Using Web App Tester and DevTools

Web App Tester is a tool that lets you test your hosted and packed apps on Fire Tablet devices.

Web App Tester also enables using DevTools to debug your web app. For information on getting and using DevTools, see Debugging Your Web App.

Resolution and Page Scaling

See Detecting the Device's Display Characteristics for information about screen size and other device characteristics. For more information about design guidelines for web apps, see Best Practices for Developing Web Apps

Testing IAP

Use App tester to test the IAP v2.0 API in your web app. See Install and Configure App Tester.

Retrieving the Advertising ID and Ad Tracking Preference

Web apps can retrieve the advertising ID and the ad tracking preference (see Advertising ID for details about these features). After you include the Web App API script (as described above in Including the Amazon APIs), an AmazonAdvertising object enables two functions in your web app: getAdvertisingId and getLimitAdTrackingPreference. Both functions have two parameters each — a success callback and an error callback. The signatures look like this:

AmazonAdvertising.getAdvertisingId(successCallback, errorCallback)
AmazonAdvertising.getLimitAdTrackingPreference(successCallback, errorCallback)

When you call these functions, the returned value is passed to the success callback:

  • The getAdvertisingId function passes the advertising ID to the success callback.
  • The getLimitAdTrackingPreference function passes either a 0 (for false) or 1 (for true) to the success callback. This value indicates what the user's ad tracking preference is.

If an error occurs when processing the request, the error message will be passed to the error callback. Your web app should gracefully handle situations when the advertising ID or limit ad tracking responses are not available.

When you submit your web app in the Developer Console, on the App File(s) tab, in the Web App Features section, select Amazon Advertising.

Select Amazon Advertising when you submit your app in the Developer Console
Select Amazon Advertising when you submit your app in the Developer Console