LiveCode Mobile Development Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Becoming an Android developer

It is possible to develop Android OS apps without having to sign up for anything, but we'll try to be optimistic and assume that within the next 12 months, you will find time to make an awesome app that will make you rich! To that end, we'll go over what is involved in signing up to publish your apps in both the Android Market and the Amazon Appstore.

Android Market

A good starting location would be http://developer.android.com/.

Android Market

You will be back here shortly to download the Android SDK, but for now, click on the Learn More link in the Publish area. There will be a sign-in screen; sign in using your usual Google details.

Tip

Which e-mail address to use?

Some Google services are easier to sign up for, if you have a Gmail account. Creating a Google+ account, or signing up for some of their Cloud services, requires a Gmail address (or so it seemed to me at the time!). If you have previously set up Google Checkout as part of your account, some of the steps in signing up process become simpler. So, use your Gmail address, and if you don't have one, create one!

  • Google charges a $25 fee for you to sign up for Android Market. At least you find out about this right away! Enter the values for Developer Name, Email Address, Website URL (if you have one), and Phone Number.
    Android Market
  • The payment of the $25 can be done through Google Checkout.
    Android Market
  • Using Google Checkout saves you from having to enter in your billing details, each time. Hopefully you won't guess the other 12 digits of my credit card number!
    Android Market
  • Finally, you need to agree to the Android Market Developer Distribution Agreement.
    Android Market
  • You're given an excuse to go and make some coffee…
    Android Market
  • Some time later, you're all signed up and ready to make your fortune!
    Android Market

Amazon Appstore

Whereas the rules and costs for the Google Android Market are fairly relaxed, Amazon has taken a more Apple-like approach, both in the amount they charge you to register and in the review process for accepting app submissions. The starting page is http://developer.amazon.com/home.html.

Amazon Appstore
  1. When you click on Get Started, you will be asked to sign into your Amazon account.
    Amazon Appstore

    Tip

    Which e-mail address to use?

    This feels like déjà vu! There is no real advantage in using your Google e-mail address when signing up for the Amazon Appstore Developer Program, but if you happen to have an account with Amazon, sign in with that one. It will simplify the payment stage, and your developer account and general Amazon account will be associated with each other.

  2. You are asked to agree to the APPSTORE DISTRIBUTION AGREEMENT terms before learning about the costs.
    Amazon Appstore
  3. Those costs are $99 per year, but the first year is free. So that's good!
    Amazon Appstore
  4. Unlike the Google Android Market, Amazon asks for your bank details upfront, ready to send you lots of money later, we hope!
    Amazon Appstore
  5. That's it; you're ready to make another fortune, to go along with the one that Google sends you!
    Amazon Appstore

Pop quiz — when is something too much?

  1. You're at the end of developing your mega-app; it's at 49.5 MB in size, and you just need to add title screen music. Why would you not add that two-minute epic tune you have lined up?
    • a. It would take too long to load
    • b. People tend to skip the title screen soon anyway
    • c. The file size is going to go over 50 MB
    • d. Heavy metal might not be appropriate for a children's storybook app

Downloading the Android SDK

Head back over to http://developer.android.com/, and click on the Download link, or go straight to http://developer.android.com/sdk/index.html.

Downloading the Android SDK

Note

In this book, we're only going to cover Windows and Mac OS X (Intel), and only as much as is needed to make LiveCode work with the Android and iOS SDKs. If you intend to do native Java-based applications, then you may be interested in reading through all of the steps that are described in the web page: http://developer.android.com/sdk/installing.html.

Click on the Download link for your platform. The steps you'll have to go through are different for Mac and Windows. Let's start with Mac.

Installing Android SDK on Mac OS X (Intel)

LiveCode itself doesn't require an Intel Mac; you can develop stacks using a PowerPC-based Mac, but both the Android SDK and some of the iOS tools require an Intel-based Mac, which sadly means that if you're reading this as you sit next to your Mac G4 or G5, then you're not going to get too far!

The file that you just downloaded will automatically expand to show a folder named android-sdk-macosx. It may be in your downloads folder right now; a more natural place for it would be in your Documents folder, so move it there before performing the next steps.

There is an SDK Readme text file that lists the steps you will need to take. If those steps are different to what we have here, then follow the steps in the Readme, in case they have been updated since the steps shown here were written.

Open the application Terminal, which is in Applications/Utilities. You need to change the directories to be located in the android-sdk-macosx folder. One handy trick in Terminal is that you can drag the items into the Terminal window to get the file path to that item. Using that trick, you can type cd and a space into the Terminal window, then drag the android-sdk-macosx folder just after the space character. You'll end up with this line:

new-host-3:~ colin$ cd /Users/colin/Documents/android-sdk-macosx 

Of course, the first part of the line and the user folder will match yours, not mine! The rest will look the same. Here's how it would look for a user named fred:

new-host-3:~ fred$ cd /Users/fred/Documents/android-sdk-macosx 

Whatever your name is, press the Return or Enter key after entering that line. The location line changes to look similar to the following:

new-host-3:android-sdk-macosx colin$ 

Either type carefully or copy and paste this line from the read me file:

tools/android update sdk --no-ui 

Press Return or Enter again. How long the downloads take will depend on your Internet connection. Even with a very fast Internet connection, it will still take over an hour.

Installing Android SDK on Windows

The downloads page recommends using the exe download link, and that will do extra things, such as check whether you have the Java Development Kit (JDK) installed. When you click on the link, use either the Run or Save options as you would with any download of a Windows installer. Here we opted to use Run. If you do use Save, then you will need to open the file after it has saved to your hard drive. In the following case, as the JDK wasn't installed, a dialog box appears saying to go to Oracle's site to get the JDK:

Installing Android SDK on Windows

If you see this, then you can leave the dialog box open and click on the Visit java.oracle.com button. On the Oracle page, you have to click on a checkbox to agree to their terms, and then on the Download link that corresponds with your platform. Choose the 64-bit option if you are running a 64-bit version of Windows, or the x86 option if you are running 32-bit Windows.

Either way, you're greeted with another installer to Run or Save, as you prefer. Naturally, it takes a while for that installer to do its thing too! When the installation completes, you will see a JDK registration page; it's up to you if you register or not.

Back at the Android SDK installer dialog box, you can click on the Back button, and then the Next button to get back to that JDK checking stage; only now it sees that you have the JDK installed. Complete the remaining steps of the SDK installer, as you would with any Windows installer.

One important thing to notice; the last screen of the installer offers to open the SDK Manager. You do want to do that, so resist the temptation to uncheck that box!

Click on Finish, and you'll be greeted with a command-line window for a few moments, then the Android SDK Manager will appear and do its thing.

Installing Android SDK on Windows

As with the Mac version, it takes a very long time for all these add-ons to download.

Pointing LiveCode to the Android SDK

After all that installation and command-line work, it's a refreshing change to get back into LiveCode!

Open the LiveCode Preferences, and choose Mobile Support.

Pointing LiveCode to the Android SDK

We will set the two iOS entries after getting iOS going (on Mac that is, these options will be grayed out on Windows). For now, click on the button next to the Android development SDK root field, and navigate to where the SDK has been installed. If you followed the earlier steps correctly, then it will be in the Documents folder on Mac, or in C:\Program Files (x86)\Android\ on Windows (or somewhere else if you chose to use a custom location).

Phew! Now, let's do iOS…

Pop quiz — tasty code names

  1. Android OS uses some curious code names for each version. At the time of writing, we're on Android OS 4, which had a code name of Ice Cream Sandwich. Version 4.1, introduced at Google I/O in 2012, is Jelly Bean, and the following version is thought to be Key Lime Pie. Which of these is most likely to be the code name for the subsequent Android OS?
    • a. Log Cabin
    • b. Lunch Box
    • c. Munchies
    • d. Lemon Cheesecake