Developer Console
Appstore Blogs

Appstore Blogs

Want the latest?

appstore topics

Recent Posts

Archive

December 12, 2012

Amazon Mobile App Distribution Program

Amazon Device Messaging is a new service that lets you send push notifications from the cloud to Kindle Fire devices that run your app. Amazon Device Messaging makes it easy for you to drive engagement with your customers and to create new opportunities for monetization and use.

 

Adm-1

With Amazon Device Messaging, you can send messages to individual users on specific devices. You can update customers on game play, invite them to purchase a related product, or send other messages that create a richer app experience.

 

The Amazon Device Messaging service is now available to developers who are accepted into our beta program. Apply here. We’ve created the Amazon Device Messaging API to be not only easy to use, but also:

 

  • Simple. Amazon Device Messaging is a transport mechanism, optimized to queue your messages and deliver them to a targeted instance of your app. For example, upon receiving a message, your app might post a notification, display a custom user interface,or sync data. 

 

  • Efficient. Amazon Device Messaging respects users' battery life, so you can, too. Using the Amazon Device Messaging service allows your app to avoid performing polling, a serious battery drain, while not requiring additional power to stay connected —a benefit your users will appreciate.

 

  • Free. In addition to providing a best-in-class payload size of up to6KB per message, Amazon Device Messaging is available at no cost to developers.

 

Kindle developers have already started to express their interest in Amazon Device Messaging. “We are very excited that Amazon is extending the Kindle platform capabilities with push messaging and look forward to building on top of it for a richer, more engaged application experience,” notes Scott Kveton, CEO of Urban Airship.

 

Amazon Device Messaging is now available as a limited-access beta and is supported on Kindle Fire HD and Kindle Fire (2nd Generation) devices. Applytoday to get access through the Amazon Mobile App Distribution Portal,and see just how easy it is to stay in touch.

December 10, 2012

Amazon Mobile App Distribution Program

One of the early interactions that customers have with an app,even before purchase or download, is through its metadata: icons, screenshots,videos, and related imagery. Well-designed and high-quality visual assets have a positive impact and lead to a better customer experience. For you, that means greater customer acquisition and superior brand perception for your apps.

In our earlier blog post “SubmittingVisual Assets”, highlights the following points to consider while designing these assets:

  • Use visuals to demonstrate to customers the look and feel of your apps
  • Take screenshots of different levels or features of your apps and display them in a logical order
  • Provide visuals that complement the story in the app description
  • The more visual assets the better

    In the same post, we provide steps to submit visual assets on the Amazon Mobile App Distribution Portal. This blog post provides further details that you should consider while submitting visual assets to ensure high quality.

    Image Resolution

    There are multiple placements possible on Kindle Fire tablets and Amazon.com for images submitted through the Distribution Portal. Some images might be re-sized to fit the placement. To ensure high quality after resizing or prevent resizing for certain placements, submit images with following resolutions:

    Assets-1

    Image Placements

    Here are some of the prominent placements for the visual assets on Kindle Fire and Amazon.com website:

    Assets-2
    Assets-3

    Image Scaling

    An image might require up-scaling before submission. Quality of image after up-scale depends upon the interpolation method used. A few common interpolation techniques supported by imaging software are cubic, lanczos2 and liner. Cubic interpolation delivers the best quality but it is a time consuming operation. Lanczos3 method also delivers excellent results however it is not supported by all imaging software. Linear interpolation takes less time but at the cost of quality.Up-scaling is quickest if no interpolation method is used but delivers low quality output. Therefore we recommend using cubic interpolation method for highest quality scaled images.

    Sharpening

    Use sharpening to improve the quality of the image. Sharpening is a common feature in most image editing software.

    Alpha Transparency

    Images uploaded on the distribution portal must be in PNG format. This format allows alpha-transparency that enables dropping shadows for various backgrounds.

    Video Codecs & Resolution

    Promotional videos submitted with other the visual assets are placed with the screenshots on Kindle Fire tablets and on Amazon.com. The best format for video is mpeg4 (H.264) 1080p. We will automatically downscale the video as needed. Several video editing tools are available for video editing on PC & Macs. On-device screen recording is not available on Kindle Fire tablets. 

    December 06, 2012

    Amazon Mobile App Distribution Program

    Crash Reports are now available to help you debug your mobile apps quickly and efficiently. Crash Reports can be found in the Reporting section of the Amazon Mobile App Distribution Portal. Crash Reports are available to you immediately, and can be used to help you diagnose errors caused by unhandled Java exceptions. We designed this report to make it easier to improve your customer experience, and therefore earn better reviews and sell more apps.

     

    When you log in to the Distribution Portal and access your Crash Reports, the first view you will see summarizes total reported crashes for each app in your catalog:

     

    Crashblog-1

     

    If you wish to do a deeper investigation of a particular app, you may click through to see the various error types that caused your app to crash, with the option to filter the data and select custom date ranges.

     

    Crashblog-2
    If you wish to learn more about a particular error type, you may click through to the error detail page. This view allows you to check for device, OS, or version dependencies, and to view the stack trace.

     

    Crashblog-3

    December 05, 2012

    Amazon Mobile App Distribution Program

    Today, we announced a new,free A/B Testing service for developers like you, who distribute their app or game through the Amazon Mobile App Distribution Program. This service was built to help you improve your customer retention and monetization through in-app experimentation. Amazon’s A/B Testing service is easy to integrate, simple to control, and is built on Amazon Web Services. This means you can be up and running in less than a day and trust that the service will scale with your app.

     

    When we set out to buil dan A/B Testing service, we met with developers to learn what they needed most.We discovered that it was something very simple--to better understand customer needs and to be able to react to those needs quickly. Our A/B Testing service provides simple to integrate tools that enable you to continually create and run experiments, view how customers are reacting to these experiments, and release new, improved experiences without writing any more code or resubmitting your game or app.

     

    The service’s benefits include:

     

    Free to Use: our A/B Testing service is free to use for developers distributing their app or game through the Amazon Mobile App Distribution Program.

     

    Easy Integration: early partners report that the SDK can be integrated and ready for release in less than a day.

     

    Precise Control: set up experiments and monitor results from the familiar Mobile App Distribution Portal.

     

    Painless Deployment: server-side logic allows you to quickly iterate tests and deploy new, improved experiences to customers without having to resubmit your APK or write any additional client-side code.

     

    Effortless Scaling: built on Amazon Web Services, Amazon’s A/B Testing service lets you focus on building great games and apps instead of architecting scalable back-end services.

     

    With Amazon’s A/B Testing service you no longer need to guess when deciding between different customer experiences.You can evaluate which in-game promotion drives better performance, which button design maximizes customer click-through, or which tutorial offers the highest conversion rate. 

     

    The Amazon A/B Testing service is currently available in beta. Learn more and get started with A/B Testing here

    December 04, 2012

    Amazon Mobile App Distribution Program

    Amazon recently introduced two new HD tablets: the Kindle Fire HD 7” and Kindle Fire HD 8.9". While most developers have had few problems transitioning apps from phone layouts and hardware to run well on the Kindle Fire HD tablets, customer feedback, as well as our own Quality Assurance reviews, has identified a few development tips you can use to deliver a great experience on the new HD tablets.

     

    Plan for the Screen Layout

    Customers love the larger format of the tablets. That's why it's important to make sure your app is designed for high-density screens with correctly sized images, and fill the screen size by using appropriate layouts(e.g., res/layout-sw800dpfor the Kindle Fire HD 8.9" and res/layout-sw533dp for the Kindle Fire HD resource directories). Appropriate use of the screen is especially important for apps that want to use the HD designation.Make sure to check out the documentation we provide on optimizing for high-density screens on the Mobile App Distribution Portal as well as onthe blog.

     

    Display the Right Assets

    For your apps to support multiple devices, you will want to make sure to display the right assets in the right place. If your app will be downloading additional resources based on the platform, it's important to make sure you are selecting the correct assets for the device. The best way to future-proof your app is usually to use feature detection or resolution detection, but as a fallback option you can use device user-agent or Build.MODEL strings. If you are relying on device strings, we recommend managing that list on a server, so you can easily add new devices or update existing ones. If instead you hard-code the strings, you'll have to deploy a new .apk each time you wish to update or add a new string. You can find the Kindle Fire android.os.Build.MODELand user-agent strings in our Device and Feature Specifications.

     

    Sensor-Based Orientation

    Every Android tablet defines top of the screen differently.On the Kindle Fire HD tablets, the default rotation is in landscape mode with the camera at the top (ROTATION_270),whereas landscape might be the opposite (ROTATION_90) for other devices. If your app is designed to work in landscape mode, then we recommend that you use sensor-based orientation rather than relying upon the rotation value, e.g. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);

     

    Manage Memory Use

    With the larger screen sizes of HD devices, efficient memory management becomes even more crucial for your app, as more memory is required for displaying larger bitmaps.

     

    In your app, ActivityManager.GetMemoryClass();returns the heap size and will help you understand how aggressive you need tobe in memory management. The default application heap size is 48MB for KindleFire HD 7” and 64MB for Kindle Fire HD 8.9”. If your app attempts to exceed thedefault heap size, you will receive an OutOfMemoryException.

     

    The best way to understand how memory usage is affectingyour app’s performance is by using Logcat, via DDMS or the command line, to examinethe logs for Garbage Collection events and analyzing heap usage and memoryallocation. The Dalvik Garbage Collection logging statement contains a lot ofinformation that will help determine if your app has potential problems such ashigh memory usage or potential memoryleaks. For an overview of how to use DDMS and MAT to analyze memory issues,we recommend reading MemoryAnalysis for Android Applications.

     

    GC_CONCURRENTfreed 380K, 17% free 16204K/19335K, paused 1ms+2ms

     

    The first statement describes why the Garbage Collection actionwas performed. It can have the following values:

     

    • GC_CONCURRENT – called when heap isfilling up to prevent a expensive GC_FOR_MALLOC call.
    • GC_FOR_MALLOC – called when the heap isfull. The application is paused during collection.
    • GC_HPROF_DUMP_HEAP – Indicates a HPROFfile has been created.
    • GC_EXPLICIT – Indicates an apprequested Garbage collection by calling System.gc()

     

    It is normal to see a healthy amount of GC_CONCURRENT logstatements as your app is running. However, watch for large amounts ofGC_CONCURRENT calls in areas where response time is critical. A consistentGC_FOR_MALLOC could indicate that your app is close to the edge of its memoryconstraints.

     

    The logging statement also indicates how much memory wasfreed, how much of the heap is currently free, and how long Garbage Collectorhad to pause the app to complete its work.

     

    Android also provides a way to expand your maximum heap sizeby adding android:largeHeap="true" to yourapp's manifest. This will increase your maximum heap size to 256MB. However,this is not silver bullet solution. A larger heap size means longer pauses for GarbageCollection and a degraded overall user experience as background apps aretrimmed to free up memory. The performance hit is not trivial, so only use whennecessary and for apps that don’t rely on a real-time user response, such as afast-paced game.

     

    Test Your App (Before We Do)

    Our QA teams run a number of tests to make sure apps willrun as expected on the Kindle Fire HD tablets. For example, we run an automatedanalysis of the manifest and app. We also do in-depth usage and “stresstesting” to try and identify issues before our users might see a problem. Ourtesting, however, can’t identify every possible issue, so the more testing and optimizingyou can do before you submit your app, the better experience your users willhave. Make sure to follow our pre-submissiontesting guidelines before submitting your app.

    November 27, 2012

    Amazon Mobile App Distribution Program

    We are pleased to announce that you can now distribute your games and apps to Amazon customers in Japan. Check out the press release here

    Thanks to our community of app developers, Amazon's mobile app distribution continues to expand internationally. Together, we are making it easy for consumers to shop, discover and buy new content on their Android device, Kindle Fire or Kindle Fire HD through personalized recommendations, customer reviews and differentiating programs like Free App of the Day. 

    Amazon’s developers have reported strong monetization from the apps they've distributed, thanks to the In-App Purchasing API and Amazon’s 1-Click purchasing. And we encourage you to customize your apps for different countries to ensure customers have the best experience possible. You can learn more about Android localization tips and resources and steps for localizing your app in the Distribution Portal in previous posts here on the blog, or learn more about developing for Kindle Fire from Kindle Fire Development Resources. Plus, check out tips from Gamevil on localizing for Japan.

    New to Amazon? We’re currently waiving all first year program fees  It’s free to register for a developer account and it’s easy to download our SDK here.

    November 27, 2012

    Amazon Mobile App Distribution Program

    Starting today, the Amazon Maps API is now open to all developers.

     

    We first launched the API as a public beta in September. Since that time, we have received a great deal of interest in our Amazon Maps API offering and partnered with developers to integrate mapping into Kindle Fire tablet apps. Developers like Hipmunk, Evernote, Trulia and Zillow now use the Amazon Maps API on Kindle Fire HD and the all-new Kindle Fire.

     

    The Amazon Maps API has two core features:

     

    • Interactive Maps. You can embed a Map View in your app for customers to pan, zoom and fling around the world. You have the option to display a user’s current location, switch between standard maps and satellite view, and more.
    • Custom Overlays. You can display the locations of businesses, landmarks and other points of interest with your own customized markers and pins.

     

    The Amazon Maps API is now part of the Amazon Mobile App SDK. Learn more about how easy it is to add maps to your apps in the Mobile App Distribution Portal.

    November 26, 2012

    Amazon Mobile App Distribution Program


    Reinvent
    The Amazon Mobile App Distribution team will be on-site at Amazon’s first developer conference, AWSre: Invent, all this week. Stop by our booth and meet with marketing and technical representatives—we’ll be there to answer your questions about getting your apps optimized and marketed on Kindle Fire.

    As a mobile app developer, here are some sessions that may interest you:

    Distributing Apps through Kindle Fire and the Amazon Appstore for Android
    November 28th– 10:30am to 11:20am

    Aaron Rubenson, director of the Amazon Appstore, will provide an overview of the Amazon Mobile App Distribution Program, the Amazon Mobile App SDK, and resources available to developers for Kindle Fire tablet optimization. Learn how to grow your business by engaging new customers and monetizing your apps.

    Monetizing Your App on Kindle Fire: In-App Purchasing Made Easy
    November 29th– 10:30am to 11:20am

    Mekka Okereke, developer services lead for the Amazon Appstore, will discuss how in-app purchasing can help you monetize your app and grow your business, as well as how to integrate the Amazon In-App Purchasing API into your mobile apps.

    TinyCo’s Best Practices for Developing, Scaling, and Monetizing Games with AWS and Amazon
    November 29th– 3:00pm to 3:50pm

    Suli Ali, Co-Founder and CEO of TinyCo, will share their best practices for developing engaging titles that work across mobile platforms. TinyCo has learned how-to scale their AWS app servers and databases to handle viral demand, and they will talk about what they learned while they were developing their gaming platform and code libraries. Additionally, TinyCo was successful marketing and monetizing their game with the Amazon Appstore and Kindle Fire, and they will explain how-to integrate with Amazon’s in-app purchasing service.

    To learn more about our participation in AWS re: Invent,read our earlier post here. We hope to see you there!

    November 22, 2012

    Amazon Mobile App Distribution Program

    Amzn_mobile_apps_300x120
     

    It’s that time of year again—when games provide bonus holiday levels and Santa hats pop up on app icons everywhere. It’s also the time when customers will be opening up new gadgets, phones and tablets as gifts. We won’t be closed during the holidays, butyou should submit your apps and app updates now to make sure they’re live in time for gift opening.

    November 20, 2012

    Amazon Mobile App Distribution Program

    TashaKim, Public Relations Manager, GAMEVIL, is our guest blogger for this post.

     

    GAMEVIL is a leading mobile games publisher and developer headquartered in Seoul, Korea,with branches in Los Angeles, California, and Tokyo, Japan. GAMEVIL has expanded their global presence over the years through an ambitious lineup of internal and third party titles localized in eight different languages. GAMEVIL specializes in mid-hardcore mobile games and prides itself on their strong following of players who enjoy their RPG-based titles.

     

    At GAMEVIL,we believe that localization is one of the most important steps during post-game development. Correctly localizing a product not only promotes accessibility toa wide range of players across the world but also establishes global brand awareness. Our games are localized in over eight languages through in-house translators as well as third-party companies. Due to the geographical closeness and cultural similarities, our games are heavily popularized in Asia. Japan, in particular, holds a high percentage of downloads and monetization. We believe this is in part due to the localization of our content into the Japanese language and culture. 

     

    Gamevil-1
     

    Below are a few guidelines we learned in our experiences localizing to Japanese as well as other Asian countries that may help other developers:

     

    Translation is Not Localization

    There are countless outsourcing companies overseas that will offer a literal translation of the language, but because so many RPG titles hold a rich and deep storyline,a literal translation would render the story awkward, bland, and lose the interest of the player. At GAMEVIL Japan, we translate the game internally and often outsource to third-party translators as well. Then, we initiate a second round of in-house translations. This portion focuses more on the cultural nuances and idioms that might not have translated seamlessly.

     

    Understanding the Culture: The Importance of Physical Presence

    We believe that it’s not enough to simply localize into a language through text, but that a full immersion is the best way to understand a culture and what is relevant in the region. The staff members at our Tokyo office are Korean/Japanese who have a sound comprehension of the social and cultural nuances. As similar as East Asian cultures may seem, there are still dynamic differences linguistically between countries that require sensitivity and attention. Once a literal translation is done, GAMEVIL Tokyo will go through a proofread, cross checking the text of the original document and implement any necessary changes. This process usually consists of omitting phrases that are irrelevant and adding text that will vibe well with the Japanese gaming culture.

     

    The Importance of Proofreading

    One key aspect that remains an extreme priority in our localizing is in the final steps of proofreading. We check each line to make sure that the meanings and expressions held behind each word and phrase flows seamlessly. The last thing that you would want is to make your game seem foreign to native gamers. We will usually have at least three rounds of thorough review before the translation is released to the public.

     

    Localize the Entire Experience

    One common misconception is that localization simply ends with the text, but localization often applies to the whole game. We cater each game according to regions. For many of our titles, we will implement Global, Asian, and Korean servers to create an experience that is relevant and user friendly. In addition, we take a user’s environment into consideration. For many Japanese users, gameplay will take place during a commute on the subway or bus in addition to heavy gameplay at home. We try to focus on quick loading times to encourage gameplay during short sessions. For our strong RPG and sports titles, we create short side quests such as the Abyss system in ZENONIA® and Exhibition Mode in Baseball Superstars® that can be enjoyed in short sessions. Japanese users are also big gamers and enjoy the anime RPG-style of many of our titles. With an immersive storyline and high-quality visuals combined with a well-polished text, our titles have seen success in terms of downloads and purchases in Japan.

     

    Gamevil-2
     

    We want to put out a product that seems indigenous to the users as they play the game. Our end goal is to create a game that transcends language and cultural boundaries that can be enjoyed by people regardless of age,gender, and ethnicity.

    November 19, 2012

    Amazon Mobile App Distribution Program

    Integrating Amazon’s In-App Purchasing and Amazon GameCircle APIs into mobile games is easy, but we’re always working to make it even quicker and easier. Today, we're pleased to announce the release of new plug-ins for the In-App Purchasing and GameCircle APIs for the Unity game engine.

     

    If you build your games with Unity, you can now use these plug-ins to rapidly add both In-App Purchasing for virtual goods and GameCircle for leaderboards, achievements, and Whispersync for Games. 

     

     

    Unity
     

    Unity Technologies' game engine is one of the most popular tools for creating games. It enables you to easily create rich, interactive 3D experiences by providing ways to assemble your art and assets into scenes and environments, add physics, and simultaneously play-test and edit games. When you’re finished building and testing, the Unity engine creates a binary targeted for your chosen platform –like an Android APK which you can publish to Kindle Fire and the Amazon Appstore for Android.

     

    The new plug-ins for Unity are available today for free as part of the AmazonMobile App SDK. You can download the latest version here. Just follow the simple instructions in the documents to get started. Of course, you’ll also need the Unity game engine in order to use the plug-ins. If you haven’t tried it yet, you can download a free version of Unity here

     

    Sign in to your Amazon Mobile App Distribution Portal account now to get started.

    November 18, 2012

    Amazon Mobile App Distribution Program

    CJ Frost, Technical Evangelist for Amazon Kindle, is our guest blogger for this post.

     

    Kindle Fire tablets are designed to be rich content consumption devices. To make sure your app supports this goal and provides the best user experience, keep in mind that you are building for a tablet, not a smartphone. Many apps are derived from existing Android smartphone apps and do not scale well to the tablet form factor. Scaled apps generally do not look as good as dedicated tablet apps and are feature-limited when compared to a similar app designed specifically for a tablet environment. These scaled apps can also suffer from significant degradation in graphics quality as the UI and elements are dynamically scaled up, by the Android platform, to fit the screen.

     

    Optimizing your app for tablets offers numerous benefits. It enables you to offer a rich,easy-to-navigate, and more detailed user experience, allows you to optimize user engagement, and can potentially improve your monetization opportunities.

     

    To help you create the best user experience for both small and larger screened devices, we've put together a list of our top phone-to-tablet app development tips.

     

    Exploit the real estate.

    Apps that are scaled up from a smaller screen size generally do not look as good as dedicated tablet apps and are feature-limited when compared to a similar app designed specifically for a tablet environment.

     

    Tabletizing-1
     

    For example, many mobile phone apps are designed as lists of items (e.g., postings, photos) that link to new pages. When viewed on a Kindle Fire tablet, these apps appear feature-limited compared to a similar app designed specifically for a tablet environment. The lists do not fill the screen, nor do they take advantage of the potential user experience features.Apps designed to be multi-pane leverage the screen real estate so users can directly open content they'd otherwise page to on a phone app.

     

    Tabletizing-2

     

    For more information on how to design your app for larger screens, see the Android documentation on devicesand displays,planningfor multiple touchscreen sizes, and movingfrom multi-page to multi-pane designs.

     

    Optimize for dynamic resizing.

    Apps designed for phones tend to be created as portrait apps only. Apps designed for tablets are optimized to be viewed in portrait or landscape mode by providing orientation-specific layouts, as demonstrated in the Simple RSS Reader Sample,and re-size dynamically using the accelerometer to sense orientation.

     

    Apps designed primarily for use on phones can also suffer from significant degradation in graphics quality as the UI and elements are dynamically scaled up, by the Android platform, to fit the screens of larger devices.

     

    For more information on how to design your app for dynamic resizing, see the Android documentation on supportingdifferent screen sizes.

     

    Design for interactivity.

    Apps designed for phones are intended to be used with one hand and provide single-point touch elements with larger touch targets to accommodate thumb navigation. In contrast, apps designed for tablets are developed using multi-point touch elements that can accommodate tablet users'normal two-handed pinch-zoom and swipe actions, providing a richer and more dynamic user experience.

     

    For more information on how to design your app for interactivity, see the Android documentation on making interactive views.

     

    Increase your reach.

    Apps designed for phones tend to provide a static representation of non-interactive content. Apps designed for tablets offer additional opportunities for interactivity and can help you extend the reach of your business by including partner content, such as ads or additional game offerings, as well as interactive applets, in a multi-pane design.

    November 14, 2012

    Amazon Mobile App Distribution Program

    Starting today, the Kindle Fire HD 8.9” will begin shipping to customers. Kindle Fire HD 8.9” offers a 1920x2000 HD resolution display,with Dolby audio and dual stereo speakers. There’s also Kindle Fire HD 8.9” 4G,which offers ultra-fast 4G LTE wireless from AT&T. This rounds out our new selection of Kindle Fire tablets, including the all-new Kindle Fire and the Kindle Fire HD, which has already become the best-selling item on Amazon worldwide.

     

    Make sure your apps are ready. We’ve provided tools to optimize your app for Kindle Fire tablets, including the Kindle Fire HD 8.9”:

     

    • Set up emulators for the Kindle Fire HD, Kindle Fire (2nd generation) and Kindle FireHD 8.9”.

     

    For a full list of resources available, read our blog post from the Kindle Fire tablet announcement here.

    November 13, 2012

    Amazon Mobile App Distribution Program

    Jonathan Wise, Technical Evangelist for Amazon Kindle, is our guest blogger for this post.

     

    Many apps these days now use back-end services or some form of network connectivity to provide customers with up-to-date information. While tablet apps usually work over Wi-Fi, tablet devices that provide cellular data connectivity, such as the Kindle Fire HD 8.9" 4G LTE, delight customers by providing the always-on connectivity they've come to expect from their smartphones. Many cellular plans have data limits, and it’s important to respect the user's cellular data plan when designing your tablet apps.

     

    To ensure your apps best utilize the customer's data plan, we recommend the following best practices:

     

    • Detect the network connection.

    Make sure your apps detect the type of network connection available and branches its behavior accordingly. For example, it is important to reduce the frequency or resolution of data downloaded in the background when the device is connected to a cellular network. To detect which type of network connection a customer is using, you can use the following code.

     

    final ConnectivityManagerconnectManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);                

    NetworkInfo netInfo =connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

    boolean isWANConnected =netInfo.isConnected();

    NetworkInfo netInfo =connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

    boolean isWIFIConnected = netInfo.isConnected();

     

    • Block file transfers in excess of 50MB.

    If a user tries to transfer a file in excess of 50MB while on cellular data, the app should provide an alert and abort the transfer. For consistency with first-party apps on the Kindle Fire HD 8.9" 4G LTE, we recommend using the following alert text:

     

    "This item is over50MB and cannot be downloaded [or uploaded] over your Mobile Network connection. Please connect to a WiFi network to download [or upload] it."

     

    Wan-1

    You should also provide two buttons: one to Dismiss the warning,and the other to take the user to his or her Wireless & Networks network settings activity to enable connection to WiFi, if available. To open the Wireless& Network settings panel from your code, add the following:

     

    startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));

     

    • Alert users of streaming audio or video.

    When a user initiates streaming of audio or video over a cellular data connection, the app should alert him or her of the possible consequences before proceeding. For consistency with other Amazon apps on the Kindle Fire HD 8.9" 4G LTE, we recommend using the following alert text:

     

    "It is recommended that you connect to a WiFi network when streaming media, to avoid excessive data use. Do you want to stream over your Mobile Network connection?"

     

    Wan-2

     

    You should also provide two buttons: one to Continue and another to Cancel. When the user clicks Cancel, do not stream the media.

     

    • Gracefully handle the loss of connectivity.

    When a customer consumes the monthly data plan on a Kindle Fire HD 8.9" 4G LTE, and has not purchased additional data, his or her cellular data connection will be disabled. The platform will manage alerts regarding data plan consumption, but your apps should gracefully handle the loss of connectivity -- both over Wi-Fi and over cellular data.

     

    Following these best practices not only helps improve the user experience of your apps by protecting customers from inadvertent data consumption, it also helps ensure users feel safe using your apps on their Mobile Network-enabled device, no matter what network they're using. 

    November 11, 2012

    Amazon Mobile App Distribution Program

    Jeremy Cath, Technical Evangelist for Amazon Kindle, is our guest blogger for this post.

     

    How quickly your app starts is a significant factor in creating a good impression for your customers, especially if they use your app frequently. To help your app start quickly, consider the following best practices.

     

    Minimize work on start-up

     

    Show a minimal experience as fast as possible--some of the user perception of performance comes from how fast an app displays something after the user launches the app, so showing a minimal splash screen as soon as possible while the rest of the initial experience is loading makes startup appear more responsive.


    The Android activity life cycle looks like this:

     

    • onCreate() <-- activity is being CREATED
    • onStart() <-- activity is becoming VISIBLE
      • onResume() <-- activity is coming to the FOREGROUND
      • onPause()
    • onStop()
    • onDestroy()

     

    So one of the most effective ways to optimize startup time is to minimize tasks that take place in onCreate() and onStart().

     

    Show a minimal splash screen at startup

     

    If your full activity takes some time to display, starting with a minimum experience and transitioning to the main part of your application gives the user the impression of a responsive app.

     

    One solution is described below. For a fuller version, download the Kindle Fire sample code and see the SampleSplashScreen sample.

     

    <activity

       android:name=".Min"

       android:label="@string/title_activity_min"

       android:theme="@style/Theme.MinBackground" >

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>

    <activity

       android:name=".Full"

       android:label="@string/title_activity_full" >

    </activity>

     

    Notethe use of the theme: "MinBackground." This should be defined intheme.xml.

     

    <style name="Theme.MinBackground" parent="android:Theme">

        <item name="android:windowBackground">@color/gray</item>

        <item name="android:windowNoTitle">true</item>

    </style>

     

    Andthe color "gray" can be defined in color.xml.

     

    <color name="gray">#444444</color>

     

    "Min" should be as simple as possible, for example (min_layout.xml):

     

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

       xmlns:tools="http://schemas.android.com/tools"

       android:layout_width="match_parent"

       android:layout_height="match_parent">

    </RelativeLayout>

     

    You could add a logo or text to this screen, but the overall goal is to make it lightweight and fast.

     

    The launcher will invoke Min when starting the app. Inside Min you can then invoke Full(in a thread), which will display once loaded by doing this:

     

    public class Min extendsActivity {

     

    public class Min extendsActivity {

     

       @Override

        publicvoid onCreate(BundlesavedInstanceState) {

            super.onCreate(savedInstanceState);

     

    // Hide the soft keys and status bar          I        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

           WindowManager.LayoutParams.FLAG_FULLSCREEN);

     

            // Display this activity.

           setContentView(R.layout.min_layout);

     

            // Create a thread to do the heavy lifting and then

            // start the Full Activity

            finalThread workerThread =new Thread(){

               @Override

               public void run() {

                    // Call a method to perform thework.

                    Min.this.loadResources();

     

                   // Start the full Activity.

                   Min.this.startActivity(newIntent(Min.this, Full.class));

     

                   // Avoid the flash back to home screen.

                   Min.this.overridePendingTransition(0, 0);

     

                   // Never come back to this Activity.

                   Min.this.finish();

               }

            };

            workerThread.start();

        }

    }

     

     

    Tuning startup under the covers

     

    To tune startup "under the covers," consider the following tips:

     

    • Use a Thread (or AsyncTask) for longer running tasks to avoid blocking the display and allow the user to start interacting with the app faster. However, be aware that thread synchronization can also take time, so assess the trade-offs and use threads wisely.
    • Minimize allocations: The more you allocate at startup, the higher the risk that Garbage Collection will be triggered, which can result in unnecessary delays. If you are seeing references to garbage collection in the system log, you should review both your onCreate and onResume methods to look for ways to reduce allocations.
    • Defer loading dependencies: If you have services that are not required for the initial user interaction (e.g., sync services or download managers), wait until you have a natural pause to load them, or load them when first requested by the user.
      • Lazily inflate views, if you can.
      • Lazily initialize objects, and avoid static initializers for referencing expensive things (they will get fired the moment the class is referenced, odds of that being on the main thread are high), for example:

     

    // BAD!

      staticCacheManager sCacheManager = newCacheManager();

     

      // better

      staticCacheManager sCacheManager = null;

     

      publicstatic CacheManager getCacheManager() { if(sCacheManager== null) {sCacheManager = new CacheManager(); } returnsCacheManager; }

     

    • Group and load assets based on when they are needed: Rather than load all assets at the outset, only load assets when they are required, or pre-load when the user is not going to notice the activity.

     

     

    Cache network resources

     

    If your app relies on network-loaded resources, use a persistent cache to avoid a network call during startup. This also applies within the app in general—avoid relying on a network connection if the assets can be retained locally; this will improve performance while reducing the user's bandwidth consumption.

     

    Use static methods

     

    On the Android platform, static methods have been demonstrated to perform up to 20% faster than virtual methods (see here for more information).

     

     

    Avoid disk/network IO on the main UI thread

     

    • Turn on StrictMode to check for this.
    • Be mean: make StrictMode violations fatal: StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDeath().build());
    • However, when using Traceview, turn off StrictMode checking (strict checking is expensive!): StrictMode.setThreadPolicy(newStrictMode.ThreadPolicy.Builder().permitAll().build());

     

     

    StrictMode and TraceView

     

    To help you identify areas that need work in your app, there are a couple of handy tools that you should become familiar with:

     

    StrictMode will help you identify bad practices in the UI thread, such as accessing the networkor disk. For information on how to use StrictMode, see the StrictModedocumentation.

     

    Traceview can be used to profile what is happening in your app. For information on how to use Traceview,see the Traceview documentation.

     

    As an example of how to use Traceview to measure startup time programmatically, you can follow these steps:

     

    1. In onCreate() before calling super.onCreate(): Debug.startMethodTracing("somefilename");
    2. Somewhere later (when you want profiling to stop, e.g.,at the end of onResume()): Debug.stopMethodTracing();
    3. From your PC: adb pull /sdcard/somefilename.trace
    4. From your PC: traceview some filename.trace
    5. Look for methods that are consuming a lot of time. Drill down into each one until you find out what’s causing the slow down.

     

    Traceview introduces overhead on its own, and as such is not terribly useful for making absolute statements about time (e.g., that XYZ takes 10ms). It is useful for finding hotspots, and (mostly) comparing relative runtimes of sections of code. Also, it’s worth noting that overhead is only introduced on the java side. Native methods run as quickly as they normally do—so native calls end up appearing to take a smaller percentage of runtime than they actually take.

    Want the latest?

    appstore topics

    Recent Posts

    Archive