Chapter 20

Moving beyond Google

In This Chapter

arrow Making your app work on Amazon Fire

arrow Finding out which features don’t work with Fire

arrow Configuring and testing with an emulator

arrow Uploading your app to the Amazon Appstore

For Android, Google may be the biggest game in town, but it isn’t the only one. Because Google makes every release of Android open to the public via the Android Open Source Project, many companies produce their own, custom versions of the Android source code.

One company that you may be familiar with, Amazon, chose Android to run on its devices — the Fire OS tablet and phone.

The Android‐based Fire devices can run Android apps with few or no modifications. It has no access to the Google Play Store, though, which means that if you want Fire users to be able to download your app, you have to publish it to the Amazon Appstore for Android. In this chapter, you find out how to port your application to the Fire OS and then publish it via Amazon.

One reason you may want to port to the Fire is to reach more users. But only you can decide whether the additional users you’ll acquire are worth the extra effort that’s necessary. Do your homework and read relevant statistics on how many users each new platform has before you commit to expending the effort.

Working around Google Features

Because the Fire isn’t a “true” Android device (it doesn’t use the official Google Android source code but instead uses a modified version), it doesn’t have access to any of the closed‐source Google services that you might already be using. In addition, the device itself may not have certain features that you’re accustomed to:

  • Google Maps: If you’re using the Google Maps library to bring maps to your Android application, you can’t use this library on the Fire. If you use maps, you may be able to use Amazon’s Map v2, available at https://developer.amazon.com/public/apis/experience/maps.
  • Google Play Store in‐app purchasing: If your app uses in‐app purchasing to allow users to purchase from inside it, you can’t use this same API in your Fire app. Luckily, Amazon has a version of in‐app purchasing that you can use on the Fire.
  • GCM push notifications: If you’re using Google Cloud Messaging for push notifications, you won’t be able to use these on the Fire. Amazon has an alternative that you can use for Fire devices.
  • Android Lollipop: Amazon uses the version of Android source code before Lollipop was released, so the Fire has no access to any of the features in Lollipop. In particular, you’ll notice that the Fire has a unique look and feel unlike any other Android tablet.

Even without these features and services, many Android applications work on the Fire with little or no modification. If this includes your app, read on.

The Amazon App Testing Service can inspect your Android app and tell you what, if anything, needs to be updated to support the Fire OS. You can learn more about the App Testing Service at https://developer.amazon.com/public/resources/development‐tools/app‐testing‐service.

Setting Up the Fire SDK

Much like developing on Android requires the Android SDK, developing on Fire requires the Fire SDK. Because you already have the Android SDK, installing the components necessary for Fire development is simple:

  1. Open Android Studio and choose Tools ⇒ Android ⇒ SDK Manager.
  2. In the SDK Manager, choose Tools ⇒ Manage Add‐on Sites.
  3. Click User Defined Sites, click New, and add the following URL: https://s3.amazonaws.com/android‐sdk‐manager/redist/addon.xml.

    Click Close, and wait for the SDK to download.

  4. Uncheck “Installed” to only show you SDKs that are not yet installed.

    Then check the Amazon Fire Phone SDK Addon, and click Install.

After the SDK is installed, you need to modify your Gradle build file to use the new SDK.

In the build.gradle in the top level of your project (not the build.gradle in your individual app directories), change the line in bold to the following:

buildscript {
     repositories {
         mavenCentral()
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:1.0.1'
         classpath 'com.amazon.device.tools.build:gradle:1.0.0'
     }
}

In the build.gradle for your app, change your compileSdkVersion to the following:

     compileSdkVersion "Amazon.com:Amazon Fire Phone SDK Addon:17"

Now you should be able to rebuild your project for the Fire.

Setting Up Your Fire or Emulator

If you want to develop for the Fire, you need either the Fire itself to test your app with or an emulator that can act as a surrogate. Because the Fire is its own breed of Android, you can’t use the same ADB you use with other Android devices unless you make a few configuration changes.

Creating a Fire‐like emulator

If you don’t have access to a Fire, you need to create an emulator for one. Follow these steps:

  1. Choose Tools ⇒ Android ⇒ AVD Manager, then click Create Virtual Device.
  2. Click New Hardware Profile to create a new kind of virtual device.
  3. Enter the settings from Figure 20-1 and click Finish.
  4. Select your newly created Fire Phone virtual device and click Next.

    Then choose Jelly Bean API level 17 for x86 devices, as in Figure 20-2.

  5. Click Next.

    Use the default configuration and then click Finish to create your Fire Phone AVD.

image

Figure 20‐1: Settings in the Create new Android Virtual Device (AVD) ­dialog.

image

Figure 20‐2: The Virtual Device Configura­tion dialog.

Do you need to create an emulator for a different kind of Fire device? Visit https://developer.amazon.com/public/solutions/devices/kindle‐fire/specifications/01‐device‐and‐feature‐specifications for a list of all of the emulator settings for all of the ­available Fire devices.

Enabling Developer Options

If you are using a real Fire device, you need to enable Developer Options to be able to use it with ADB on your computer. To enable Developer Options

  1. Open the Settings interface.
  2. Scroll to and expand the Device section.
  3. Tap Get info about your Fire.
  4. Now tap any item in the list repeatedly.

    You must tap the item at least seven times within five seconds.

  5. Click the Developer Options button that appears at the bottom of the screen.
  6. Set the Developer Options slider to the ON position.
  7. Select USB Debugging.

Installing the USB driver (Windows only)

On Windows, to detect the Fire phone on your development computer, you must first install a modified version of the Kindle Fire USB driver that is included with the Fire Phone SDK add‐on:

  1. Run the USB driver installer at <ANDROID_SDK>/add‐ons/addon‐fire_phone_sdk_addon‐amazon‐17/tools/KindleDrivers.exe.
  2. After installing the driver, wait a few minutes for the system to update before attempting to connect the Fire phone to your development computer.

Connecting to ADB

You will now need to restart ADB. In a terminal, go to ANDROID_SDK/platform‐tools and run

Windows:

  • adb kill‐server
  • adb start‐server
  • adb devices

Mac OS X or Linux:

  • ./adb kill‐server
  • ./adb start‐server
  • ./adb devices

You now see your Fire in the output from the adb devices command.

Publishing to Amazon Appstore for Android

Publishing to the Amazon Appstore for Android is similar to publishing to the Google Play Store: You create an account, and then you may need to pay a developer fee.

Unlike the Google Play Store, apps must be reviewed on the Amazon Appstore for Android, so plan a few days between the day you submit your app and the day it becomes available on the store.

Follow these steps:

  1. Go to https://developer.amazon.com/appsandservices and click Sign In.
  2. Sign in using your Amazon login, or create a new account.
  3. Enter your developer information, such as in Figure 20-3.
  4. Agree to the Amazon Distribution Terms by scrolling down and clicking Accept and Continue ( Figure 20-4).
  5. Indicate whether you intend to monetize your apps.

    If so, fill in the necessary details, then click Save and Continue.

  6. Click the Add a New App button.
  7. Enter your app’s important information as in Figure 20-5, and click Save when you’re done.

    Feel free to fill in the other optional fields such as SKU if it’s useful to you; see Figure 20-5.

  8. Click the Availability and Pricing tab ( Figure 20-6) to choose in which countries to make your app available — and its price.
  9. Click the Description tab to set your app’s short and long descriptions, and add translations for other languages.

    Click Save when you’re done (see Figure 20-7).

  10. Click the Images and Multimedia tab ( Figure 20-8) to upload icons and screen shots to include in your app description, then click Save.
  11. Click the Content Rating tab ( Figure 20-9) to choose your app’s content rating and age restrictions by clicking the appropriate radio buttons, then click Save.
  12. Click the Binary File(s) tab (Figure 20-10) to upload your app’s binary code, then click Save.

    See Chapter 8 for more information about how to build and upload your app’s APK file.

  13. Click the Submit App button.
image

Figure 20‐3: The Registration window.

image

Figure 20‐4: Click to Accept the Distribution Terms.

image

Figure 20‐5: The New App Submission window.

image

Figure 20‐6: The Availability and Pricing tab for the Silent Mode Toggle app.

image

Figure 20‐7: The Description tab for the Silent Mode Toggle app.

image

Figure 20‐8: The Images and Multimedia tab for the Silent Mode Toggle app.

image

Figure 20‐9: The Content Rating tab for the Silent Mode Toggle app.

image

Figure 20‐10: The Binary File(s) tab for the Silent Mode Toggle app.

The review process can take anywhere from hours to days to weeks. However, when your app launches in the Appstore, you can find it in the Amazon Appstore for Android alongside other apps as shown in Figure 20-11.

image

Figure 20‐11: The Amazon Appstore for Android.

To find out more about the Amazon Appstore submission process, visit https://developer.amazon.com/public/support/submitting‐your‐app/tech‐docs/submitting‐your‐app.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
44.220.184.63