With the launch of the Fire, Amazon’s first Android-based phone, you can now create experiences where customers interact in an entirely new way with your apps. With Dynamic Perspective, apps can have peek, tilt and zoom capabilities all based on customer head movements. You can also use the Firefly button to identify virtually anything and enable actions your customers can take based on what they identify. By enhancing or optimizing your apps for Fire, you have the opportunity to enable experiences that combine realistic visuals and bring new depth to what customers can do on a phone. And while you think about the new experiences you can offer your user, you can get the current version of you app running on Fire with little or no modification. Here are 10 tips to help you get your apps running on Fire phone today!
Tip 1 – Register for a Free Amazon Developer Account
Fire uses the Amazon Appstore exclusively, and we’ve streamlined the process to make it easy to submit your app. Registration is free, fast, has no annual subscription cost, and supports both free and paid apps. Once your Fire phone app is submitted you also have the option to distribute the apps across Kindle Fire, Fire TV and Android devices simply by selecting those device targets in the developer console. The boxes indicating your intent to publish on other devices will be pre-checked in the console. Most Fire apps will also work on Kindle Fire tablets and Android devices, so just keep those checked if you are not sure. To get started:
- Sign in or register for a free developer Amazon Apps & Games Developer Portal account. If you do not already have one, you will be prompted to create an account
- Submit your payment and tax information if you intend to sell a paid app or offer in app items for purchase.
Tip 2 – Download the Fire SDKs
Fire phone development APIs fall into two categories: Dynamic Perspective SDK and Firefly SDK. Both SDKs are available through the standard Android SDK Manager as a single add-on and support a variety of programming languages.
To download the add-on simply open the Android SDK Manager from a command line or from within Android Studio and do the following:
- Add the following user-defined site, in the Manage Add-on Sites dialog: https://s3.amazonaws.com/android-sdk-manager/redist/addon.xml
- Expand Android 4.2.2 (API 17) and click SDK Platform and Amazon Fire Phone SDK Addon.
- Accept license agreement and install the packages.
- Set your project up in Eclipse and specify Amazon Fire Phone SDK in the Compile With drop-down.
The SDK includes everything you need to get started including multiple sample projects and Android Studio gradle support.
You also have the option to download the Fire Phone SDK directly without installing the add-on here.
Tip 3 – Test Your APK compatibility with the Amazon Testing Service
Fire is based on the latest version of Fire OS 3.5, which is based on Android API level 17. Android app compatibility is supported on Fire OS, so if an app runs on Android it can run on Fire with little or no effort. Simply drag and drop your Android APK and receive feedback on your app's compatibility within 90 seconds. You will also have access to additional Fire phone test results that enable you to see how your app looks and performs on Fire phone. The test results are presented in 6 hours and include carousel, peek and tilt actions.
Checking APK compatibility and submitting can be done in just a few steps:
- Drag and drop your APK to the app-testing control here.
- If your app passes testing, you can submit it to the Amazon Appstore right away. If testing reveals any issues, you will see a list of issues to address.
Tip 4 – Become Familiar with the Fire Phone Design Guidelines
Fire represents a huge leap forward in mobile user experiences. As a developer, you’ll want to design the best customer experience possible for this new platform. To help you achieve that, we’ve outlined the core design principles that will allow you to take advantage of Fire’s unique Dynamic Perspective features in our guide here.
The good news is that if you are an Android developer your app will work on Fire with little or no work, and as you will see, just a few modifications to your app’s user experience will let it better take advantage of all that the Fire SDK has to offer.
For additional best practices for designing Fire phone user experiences check out our blog post here.
Tip 5 - Add the Fire Phone Android Theme to Your App
The quickest optimization you can make is to set the application Theme in your Android app’s AndroidManifest.xml file. This updated Amazon theme will set app fonts, color pallet and skinned controls to match Fire phone’s design guidelines.
Simply set the android:theme argument to the application section of the Android Manifest to Theme.DeviceDefault, as introduced in Android 4.0, and your application will pick up the skinned controls that match Fire phone.
Tip 6 – Utilize the Fire Foundation Controls
The Fire Foundation Controls are included in the Dynamic Perspective SDK and give your app 2D controls designed and built for use with the device. These controls currently include SidePanel, HeaderNavigationBar, TabBar, ToolBar and MediaController. All of these controls can be implemented in three steps just as you would with any Android control.
Step 1: Prepare the Android Manifest
The Android manifest needs to be modified to include a <uses-library> tag to load the Foundation Controls library (in addition to setting the theme as mentioned in Tip 3).
Step 2. Place the control in your XML Layout file
In this example Android layout file we are referencing the new header navigation bar and utilizing two additional files. Strings.xml will contain the names of our menu items and header_menu.xml file defines the menu items for the HeaderNavigationBar's actions menu.
XML layout for HeaderNavigationBar inside of a RelativeLayout view:
Strings.xml containing menu item names:
Header_menu.xml containing action menu items:
Step 3. Implementing the Control
All of the APIs for Fire phone will be installed into your <Android_SDK>/sdk/add-ons/addon-amazon_fire_phone_sdk_addon-amazon-17 folder including the SDK samples. To access the controls you will need to reference them from your own app. For example, to implement the HeaderNavigationBar make sure you reference the amazon.widget.* package and implement the control. The following code shows how to inflate the XML layout into a view, obtain a reference to the HeaderNavigationBar, use the reference to set a click listener on the actions menu, and implement up navigation.
In the case of the HeaderNavigationBar we will also disable the Android title bar before inflating the layout. We can also programmatically change menu items by setting properties directly on the HeaderNavigationBar like so:
For more details on implementing Foundation Controls in your Android app check out our Implementing Foundation Controls for Fire phone guide here.
Tip 7 - Implement a Side Panel Layout
One easily identifiable layout characteristic of Amazon Fire apps is the Side Panel layout included as part of the Fire Foundation Controls. Implementing the Side Panel layout will go a long way to giving your app that Fire phone look and feel.
With this control, no matter what the current view in your app, a user can always access your menu or a context aware page just by executing a quick swipe or gesture.
For example, doing a quick right-flick of the phone (or swiping in from the left) can expose a navigation pane. You can also put a context-sensitive pane a flick away in the other direction. In the picture above, the middle content panel is a Music Store. The left panel is a navigation panel, and the right panel is context sensitive, and when the user is looking at music in the content panel, the right panel will show recommendations.
SidePanel Layout works very similar to the HeaderNavigationBar described above. You will need to reference the EAC library in your Android Manifest like above, reference the same amazon.widget library in your java code and then define the left, right and content panels in your XML layout file.
A full Side Panel sample project is included with the Fire SDK under the /Samples/SidePanels folder and you can get more details about implementing a Side Panel layout here.
If you don't have a Fire phone you can also use the simulator included in the SDK to test your SidePanel implementations.
Tip 8 – Adding Depth and Perspective to Your Android App Interface
In addition to the 2D Foundation Controls, Dynamic Perspective includes a rich set of APIs and Controls to help developers incorporate peek, tilt and zoom capabilities within their apps while adding a sense of realistic depth and perspective. These controls work behind the scenes with Fire’s advanced camera and sensors to automatically adjust their appearance based on how your application is being viewed. These new UI Controls are part of the Euclid package included in the Fire phone SDK.
For the most part, Euclid controls are very similar to their Android and Foundation Controls counterparts. Euclid controls retain the name of the original base control, but with a "Z" prepended to the name. For example, a Button control becomes a ZButton control.
Figure 1- Example of Euclid Controls. From left to right: ZCheckbox, ZButton, ZSwitch and ZRadioButton
Euclid simplifies the process of adding 3D effects to your Android apps. Because most Euclid layout and widget classes are derived from either standard Android or Amazon Foundation Control classes, you are probably already familiar with the most common methods and attributes of Euclid controls and should be able to convert your app to use the new Dynamic Perspective UI with few code updates.
The following aspects of a control remain unchanged when you swap a stock Android control for its Euclid equivalent, such as changing a Button to a ZButton:
- Click handler methods: User interaction is handled via your existing onClick() method or View.OnClickListener object.
- Screen position methods: Layout in the X and Y planes follow the same rules as 2D widgets.
- Layout methods: Euclid controls follow Android rules for scaling, sizing, and padding, and auto-resize based on layout parameters.
- Support methods: Euclid controls often inherit Android widget support for testing, accessibility, and localization.
The biggest difference between Euclid and 2D widgets is how their visual assets are produced and rendered. These differences provide new behaviors but also set some limits on what you can change. Euclid widgets are artist-created textured mesh files, including collections of vertices, edges and faces that define the shape of 3D objects.
Although you can set the color of a 3D widget, you cannot add a border, set a custom background, or make changes in View.OnDraw(). However, 3D controls do provide the same access to behaviors such as animations and head tracking without additional code.
The following summary highlights the changes between 2D and 3D controls:
- Layout parameters: 3D object layout parameters include depth in addition to height and width. While 2D Android layouts are a nested hierarchy of flat rectangles, 3D layouts are a nested hierarchy of rectangular boxes.
- Delegate classes: All 3D methods are passed to delegate classes to handle 3D operations, such as layout and animation. You do not need to extend the delegate classes unless you want to modify the stock control animations or layout.
- Missing or overridden class methods: Some 2D Android base class methods have been removed from the 3D controls because these methods are either not relevant to a 3D environment or have been replaced with true 3D paradigms. For example, stock Android controls support rotation using a faux 3D mode, whereas Euclid replaces these methods with a simplified 3D orientation method.
- Draw method: Because they are not rendered dynamically, 3D controls do not directly use the Draw method. Instead, you must build a tree of transformations and execute a drawing command using ZSceneNode and ZRenderable. This retained approach better matches the model of the underlying 3D graphics library. Note that this change is transparent if you are using the stock 3D controls in the toolkit.
- Unsupported base class attributes: Some 2D base class attributes are not supported in 3D, such as the Android faux shadow parameter. See the API reference documentation for information about specific control attributes.
- 3D-specific methods and attributes: 3D controls have 3D-specific methods and attributes, such as the ability to supply layout attributes using orientation_Zin a linear layout or depthGravity.
For more information on implementing Euclid controls be sure to check out our Dynamic Perspective UI Migration Guide here. For suggestions on when to use the standard Android widgets, 2D controls and the new Euclid controls check out our comparison matrix here.
Tip 9 – Firefly SDK: Apps that Discover the World around You
With the Firefly SDK, developers can build apps that recognize real world objects - QR and bar codes, artwork, songs, movies and more - and let customers interact with them. Firefly combines Amazon's deep catalog of physical and digital content with multiple image, text and audio recognition technologies to quickly identify over 100 million movies, TV episodes, songs and products. It can also recognize URLs, email addresses and phone numbers. Customers simply press the Firefly button to discover helpful information and take action in seconds. You can use the Firefly SDK to supplement item identification or build actionable options for customers after an item is recognized. For example, iHeartRadio used the Firefly SDK’s built-in music recognizer and music database to identify a song playing. Then they built their own Firefly action to create a station based on the song Firefly recognized.
Integration with Firefly requires the creation of a plug in. You can get complete details on implementing a Firefly plugin on our developer portal here.
Tip 10 – New Developer Incentives for Fire Phone Apps
The immersive apps you create for Fire phone are also eligible for new developer promotions. We have updated Appstore Developer Select and Amazon Mobile Ads API with more incentives.
- Appstore Developer Select: Optimize your apps for Fire phone and get enhanced merchandising and 500,000 Amazon Coins incentives for your customers. Get the details here.
- Amazon Mobile Ads API: Developers earn $6 for every thousand interstitial ads displayed across any supported device in August and September (up to one million impressions per app per month) when they distribute their apps on Fire phones and send the first ad request from a qualified app. Get the details here.
Now is the time to submit your apps and games! Apps that are submitted and approved by July 18 will be in the Amazon Appstore when Fire ships on July 25.
Be sure to check out these additional Fire phone developer resources: