No results found
December 04, 2012Amazon 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.
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.
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.
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);
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:
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.
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.