感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。
Appstore Blogs

Appstore Blogs

Want the latest?

appstore topics

Recent Posts

Archive

Showing posts by Simon Howard

April 23, 2015

Simon Howard

Some links referenced in this post will take you to third parties sites not managed or owned by Amazon

My colleague Peter (@peterdotgames) recently wrote a blog about St Patrick’s Day, and as I live in the UK I thought I would write something about St George’s Day. St George is the patron saint of England, and St. George’s Day is celebrated on April 23. His emblem is a red cross on a white background, which is the flag of England and part of the British flag.

Unlike St Patrick’s Day, there isn’t a wealth of apps specifically to celebrate St George’s Day, however, there are a number of apps that are related to England and will help you celebrate the occasion. So without further ado, below is a set of apps and games that are in some way related to England and that you can download from the Amazon Appstore.

ECB Cricket

Some people say that there is nothing more English than Cricket. They may be right although I think a Cream Tea with a Scone and Strawberry Jam is up there too!

ECB Cricket was created by the England and Wales Cricket Board, the body that looks after Cricket in England and Wales. It’s a useful app that enables you to keep track of all sorts of things that relate to Cricket. You can view information for upcoming Cricket matches, get the latest Cricket news and check out the statistics for a club (that’s the same as a team) that you follow.

Radioplayer: UK Radio on Your Kindle

The Radioplayer: UK Radio on Your Kindle app by UK Radioplayer Ltd allows you to listen to hundreds of UK based radio stations including those from the BBC. You can listen to the radio whilst doing other things and listen to catch-up programs and podcasts.

So, this could be a great way to experience a little bit of England from a far – maybe listen to some retro music from the 70s and 80s or local UK news J

Football Live Scores

England is a nation that is fascinated with Football (or should I say Soccer) - after all it is where the game began!

With the Football Live Scores app by holoduke you can keep track of what’s happening in Football in England and internationally. You can get match schedules, checkout live match scores, find out where your favorite team is in the English Football league or find out who the top scoring players are. There are also some quizzes built-in to the app.

It’s an ideal app if you are a Football fan!

Tube Map London Underground

If you live in England or are visiting you’re likely to come to London at some point to do some shopping, see a musical on the West End, or even go to a business meeting as I frequently do! Aside from Buses and Taxis, the London Underground (or the “Tube” as most of us Brits like to call it) is the main way to get about London.

Tube Map London Underground by Visual IT Ltd allows you to plan your journey from A to B on the London Underground.

The app has a handy London underground map and a route planner (so you can figure out journey time). It also lets you check the status of each of the underground lines.

TripAdvisor

The TripAdvisor app is a great way of finding good places to visit on your day off or your vacation (we call it ‘holiday’) or restaurants to eat or places to stay. You can do lots of other things with the app too as part of your trip planning.

So why not use the app to plan your day out in London or to the Roman Baths in Bath? You will often by the way hear the English debate whether “Bath” should be pronounced “Baaaaath” with an emphasis on the “a” or not. I’m not really sure…

OS MapFinder

If you’re interested in doing anything in the great outdoors in England (walking, running, cycling…), the OS MapFinder app by Ordnance Survey Leisure Limited is the app for you. With the app, you can search for thousands of places in England (plus the rest of Great Britain) such as town, points of interest and so on. You get overview mapping from the Ordnance Survey for free and optionally you can purchase more detailed maps for areas you’re interested in. This app is designed for Kindle users only.

Cheers!

If you want to know more about the history of St George’s Day in England, check out this Wikipedia link. St George’s Day is actually celebrated in various countries and for different reasons – you can find out more about which other countries celebrate St George’s Day in the same Wikipedia link.

So that’s it. I hope you have a happy St George’s Day, whether that involves planning a holiday in the Cotswolds or listening to UK radio or reminiscing about drinking a nice pint of real ale or a glass of wine in a pub somewhere in the depths of the countryside.

Simon Howard (@SimonH109)

April 20, 2015

Simon Howard

In March a new over the air software update was released for Amazon Fire TV (version 1.5) and Fire TV Stick (version 1.1) that adds a bunch of new features to these devices, both of which enable customers to use apps or play games in the living room as well as watch video and other content. At the same time a new version of the Fire TV SDK (which is for both devices) was released.

This blog is about what these new features mean to app developers and Fire TV/Fire TV Stick users. Below, I first focus on the new developer related features and then provide a summary of the remaining new features that are purely user centric. Note: some of the features are not available on Fire TV Stick and this is highlighted below.

Apps Can Now Be Installed to Internal or External USB Storage

This feature is for Fire TV users only and enables them to download apps and games to an USB storage device (hard drive or USB memory stick) that is plugged in to the Fire TV. This is in addition to the built-in 8GB available to users and it obviously means that users have the opportunity to download additional apps some of which could be yours!

By default, an app is installed in the internal storage, but if the internal storage is low and there is external USB storage available, the app may be installed onto that external storage instead. As a developer you might be wondering, where you should install your app. In most cases, you could go for either, however, if your app plays DRM-protected media then it must be installed in the internal storage. Note also that any data or files that you write to storage from your app, is always installed in the internal storage even if your app is installed in the USB storage.

You can specify that you prefer for your app to be installed to USB storage by modifying your app’s Android manifest file (AndroidManifest.xml) to include the installLocation attribute of the <manifest> element as shown below:

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

    android:installLocation="preferExternal" ... >

    ...

</manifest>

See this article on the Amazon developer portal for more details.

Easier and Quicker Debugging on Fire TV or Fire TV Stick via ADB over USB

Prior to the update, you could only connect to a Fire TV or Fire TV Stick device for development purposes over a network; for Fire TV this meant an ADB connection over a wireless or wired Ethernet connection and for Fire TV Stick this was by a wireless connection, as it does not have an Ethernet socket.

Now, you can also connect to either of the Fire TV devices via ADB over USB. This is really useful as it gives you the ability to debug your app over a faster connection. Additionally, it enables you to avoid having to connect to a wireless network in locations where you might get charged or where bandwidth is low or where perhaps you are worried about security.

To find out more about how to setup debugging for ADB over USB see this article. Also, this blog on setting up ADB is very useful.

Give Your Users a Traditional Mouse Pointer Symbol

Fire TV supports the use of a mouse that is connected via USB or Bluetooth.  If you’ve created an app that supports pointer-based input, prior to the update, the mouse pointer was always displayed as a large circle. Now, you can display a traditional mouse pointer symbol that may be more appealing to your end customers.

  

By default in the updated software, the pointer is the large circle but you can change it to a mouse pointer via an edit to the Android Manifest file as shown below:

<activity

     android:name=".MyActivity"

     android:label="My Activity">

     ...

     <intent-filter>

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

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

     </intent-filter>

     <meta-data android:name="com.amazon.input.cursor" android:value="pointer"/>

</activity>

See this article on the Amazon developer portal for more details.

Other New User Features

A set of additional new user features was introduced in the update. These are:

  • Captive portal support - Fire TV and Fire TV Stick users can now use Wi-Fi networks in hotels or other locations where web based authentication is required. Previously, you could connect to the network but there was no way to enter the username and password details
  • Browse and search Prime playlists - Fire TV and Fire TV Stick users that are also Amazon Prime customers, can choose content to play from hundreds of playlists
  • Hidden PIN entry - Fire TV and Fire TV Stick users can now enter their PIN as hidden characters when they are prompted for it whilst making purchases from the device
  • New shortcuts - If Fire TV or Fire TV Stick hold down the Home button on the remote (or Wireless Bluetooth controller) for a few seconds, a short cut menu is displayed from which the shortcuts are available to put the device to sleep, to enable display mirroring or to access settings
  • Wireless Bluetooth headphone support - Fire TV users can listen to audio from movies or TV content and apps via Wireless Bluetooth headphones

Conclusion

The new features introduced in the March update for the devices further enhance their capabilities and the new SDK brings some real benefits to developers.

You can develop for Fire TV and Fire TV Stick using Android Java with for example the Eclipse or Android Studio IDE. Alternatively, you can develop using HTML5 and a framework such as Cordova.  This article is a great starting point to learn how to port your app existing app to the platform or to create a new app.

Here are some more links to useful articles related to development for Fire TV and Fire TV Stick:

That’s it for now. There’s never been a better time to start developing for the living room!

Simon Howard (@SimonH109)

 

March 05, 2015

Simon Howard

I recently published a blog post about how you get started using the Amazon Mobile Ads API in your Android Java based app or game. This blog is about how you do the same with an iOS app or game.

What Is the Amazon Mobile Ads API?

The Amazon Mobile Ads API allows you to monetize apps and games across the Android, Fire OS, and iOS platforms by displaying ads to customers in the US, UK, France, Italy, Spain, and Germany. Ads can be banner or interstitial and will advertise products or services coming from Amazon or other well-known brands. You are paid on ad impressions served whilst some other Ad networks only pay on clicks. To get more information on the benefits of using the Amazon Mobile Ad Network, check out the Success Stories.

How Do I get Access to the APIs?

The Amazon Mobile Ads API requires iOS 6.0 or above and Xcode 5.1.1 or above. The API is part of a single SDK (the Amazon Mobile App SDK, which you can download here) that also provides access to other Amazon mobile services and APIs such as GameCircle and In-App Purchasing.  The same download also includes the necessary files to use the API in apps developed for Android.

To use the Amazon Mobile Ads API in your Xcode projects, first download the SDK and extract the zip file to the appropriate location on your development machine. Here’s what the iOS part of the SDK folder looks like on my machine:

Obtain an Application Key

Before you can use the Amazon Mobile Ads API in an app, you should create an Application Key that is unique to the application. This key is used by the Amazon framework to identify your app so it’s essential that you use the correct one so that you will be paid. Note that if you have Android and iOS variants of the same app they must use different application keys.

To create a new key you need an Amazon Apps & Games Developer Portal account. If you don’t have one, you can create an account by visiting here. Also note, because you will be receiving income into the account, you will need to add your payment and tax information details to your developer account profile.

You can bypass this step for now if you want to just try out the API using one of the sample apps. Just make sure you create your own key (and account) later.

Check out the Samples First

Before you start including the Amazon Mobile Ads API in your project, I would recommend playing around with the samples that come with the SDK. You can find these samples in the /iOS/Ads/Samples folder and they are as follows:

SimpleAdSample,

SimpleAdUniversalSample,

SimpleAdUniversalSample_Swift

Displays a banner ad and is a good introduction to the APIs. Comes in Objective-C iPhone only, universal Objective-C and Swift versions

FloatingAdUniversalSample,

FloatingAdUniversalSample_Swift

Builds upon SimpleAdSample

InterstitialAdUniversalSample,

InterstitialAdUniversalSample_Swift

Displays a full-screen interstitial ad

Building the Samples in Xcode

Building the iOS samples in Xcode is pretty straightforward. You can import the samples as individual projects into your workspace or you can just get them all in one go by importing the workspace file (.xcworkspace extension) that is in the iOS samples root folder.

If you have imported all of the samples, you will see something similar in the Xcode projects window to the following:


Running the Samples

Once you have imported a sample, there’s nothing more to do within Xcode except to select the build option. I found that all samples build OK in the latest version (6.1.1) of Xcode at the time of writing. If for example, you run the sample FloatingAdUniversalSample you will see something similar to that shown in the screenshot below when it runs:

Including the APIs into Your Own Code

Using the Amazon Mobile Ads API in your own code is relatively straightforward and this Quick Start Guide goes through the steps that you need to follow. The following sections provide some additional tips on using the APIs.

Frameworks

At a minimum you usually need to add the Mobile Ads framework AmazonAd.framework and you may need to add any of the frameworks that are listed in the section “Incorporate the API into your project” in the Quick Start Guide if they are not referenced by your project.

The screenshot below shows the project “Build Phases” settings where the frameworks are added:


Note that you add frameworks to Swift and Objective-C projects in the same way in Xcode.

Using the APIs with Swift

The Quick Start Guide does not at the time of writing discuss the Swift version of the APIs so I thought it would be useful if I provided a quick overview in the sections below.

Amazon Mobile Ads API Swift Classes

There are 5 classes in the Swift implementation of the Amazon Mobile Ads API, which I have summarized below:

AmazonAdError

Encapsulates an error code and description relating to a particular error

AmazonAdInterstitial

Helper methods and delegate associated with creating an interstitial Ad

AmazonAdOptions

Used to define options for a particular Ad that will be loaded

AmazonAdRegistration

Used to register certain information with the Amazon Mobile Ads framework at runtime so that the app can receive Ads to display

AmazonAdView

Helper methods and delegate associated with creating a banner Ad

Setting the Application Key in Swift Code

Before your app can request an Ad, it’s essential that the app registers itself with the Amazon Mobile Ads framework. To do this, your app needs to specify the application key to the framework via the setAppKey() method in the AmazonAdRegistration class. The best place to call setAppKey() is in the application method in your app’s AppDelegate class. In this method, you should place the following call:

AmazonAdRegistration.sharedRegistration().setAppKey("123")

Where: you substitute ‘123’ with the real application key in the production version of the app.

Adding Banner Ads in Swift Code

To create a banner Ad, your app must create an instance of the AmazonAdView class in the applicable UIViewController class and then load the Ad using the loadAd() method from the AmazonAdView class. The Ad is then loaded in a separate thread (created by the framework) that will report its status via callbacks in the delegate AmazonAdViewDelegate.

The abbreviated code snippet below shows the main activities that need to be done in the app’s applicable UIViewController instance.

// Connect to the banner view control in the storyboard

    @IBOutlet var amazonBannerAd: AmazonAdView!

            override func viewDidLoad() {

      super.viewDidLoad()

      // Create a banner Ad at a given size

      amazonBannerAd = AmazonAdView(adSize: AmazonAdSize_320x50)

      // During development, you must tell the framework that the

      // app is not a production version

      var adOptions = AmazonAdOptions()

      adOptions.isTestRequest = true

      // This loads the Ad

      amazonBannerAd.loadAd(adOptions)

  // Ensure our delegate receives the callback messages

  amazonBannerAd.delegate = self

    }

For simplicity, I have hard-coded the banner size as 320 by 50 pixels in the snippet above but normally you set the Ad size using constants in the AmazonAdOptions class according to whether the app is running on an iPhone or iPad. See Mobile Ads iOS API Concepts for more details.

It is essential that during development you set the isTestRequest member of the AmazonAdOptions instance (used when loading the Ad) to true. In the production version you must set it to false.

Adding Interstitial Ads in Swift Code

To create an interstitial Ad again you create an instance of the AmazonAdInterstitial class in the applicable UIViewController instance and then load the Ad using the load() method from the AmazonAdInterstitial class. The Ad is loaded in a separate thread that will then report its status via callbacks in the delegate AmazonAdInterstitialDelegate.

The abbreviated code snippet below shows the main activities that need to be done in the app’s applicable UIViewController instance to load an interstitial Ad.

 

// Connect to the banner view control in the storyboard

    @IBOutlet var interstitialAd: AmazonAdInterstitial!

            override func viewDidLoad() {

      super.viewDidLoad()

      // Create the Ad

      InterstitialAd = AmazonAdInterstitial()

      // During development, you must tell the framework that the

      // app is not a production version

      var adOptions = AmazonAdOptions()

      adOptions.isTestRequest = true

      // Loads the Ad

      interstitialAd.load(adOptions)

  // Ensure our delegate receives the callback messages

  interstitialAd.delegate = self

    }

Debugging

During development, it’s a good idea to enable logging using the associated methods in the AmazonAdRegistration class. Doing so makes it easier for you to track the messages sent to the ad framework in Xcode. Just make sure to disable logging before launching your app to production.

In Objective-C code, a good place to enable logging is in the didFinishLaunchingWithOptions method in the AppDelegate class:

    [[AmazonAdRegistration sharedRegistration] setLogging:YES];

In Swift code, the best place to do this is in the application method in your app’s AppDelegate class:

AmazonAdRegistration.sharedRegistration().setLogging(true)

Handling Banner Ad Events in Objective-C or Swift Code

As per the Android version of the API, the Amazon Mobile Ads API enables you to hook into several events related to a banner Ad. For example, you can hook into an event that indicates that the Ad failed to load and in that case you could could determine the possible cause of the failure and if applicable choose to fill the advert using an alternative ad network.

You handle banner Ad events using callback functions that are implemented by AmazonAdViewDelegate. Here are the main functions that you might use…

viewControllerForPresentingModalView()

This callback function must be implemented and it tells the AmazonAdView class which view controller class it should use to render the Ad and also to report events.

adViewDidLoad()

Implement this callback if you want to do something when the Ad was successfully loaded.

adViewDidFailToLoad()

Implement this callback if you want to so something when an Ad failed to load successfully. You would typically determine the likely cause of the error using the error code and respond accordingly.

adViewWillExpand()

Implement this callback if you want to know when the user has tapped the Ad and it is to be displayed modally.

adViewDidCollapse()

Implement this callback if you want to know then the user has closed down an Ad that was displayed modally.

Handling Interstitial Ad Events in Objective-C or Swift Code

You can also handle events for interstitial events via callback functions that are implemented by AmazonAdInterstitialDelegate

interstitialDidLoad()

Implement this callback if you want to do something after the interstitial Ad has loaded successfully.

interstitialDidFailToLoad()

Implement this callback if you want to do something when the interstitial Ad has failed to load. Typically you would process the error code and act accordingly.

interstitialWillPresent(), interstitialDidPresent()

Implement these callbacks if you want to do something just before or after the interstitial Ad is displayed.

interstitialWillDismiss(), interstitialDidDismiss()

Implement these callbacks if you want to do something just before or after the interstitial Ad is removed from the display.

It’s worth checking out this article about event tracking and error handling. It describes how you hook into the events in Objective-C code but it’s also still very relevant for apps that have been written using Swift. Also, it’s worth stepping through the sample code so that you are clear on when the events are received.

Conclusion

It’s easy to integrate the Amazon Mobile Ads API into your iOS app or game. Doing so provides you with additional ways in which you can monetize via ads relating to products or services that come from Amazon or other well-known brands. Once you have integrated the API, you are paid for ads on impressions rather than on clicks.

Here are some more links to useful articles on using the Amazon Mobile Ads API in your iOS app:

That’s it for now. In my upcoming blogs I will discuss how you can use the Amazon Mobile Ads API in games or apps created using various frameworks, as well as provide guidelines on Ad mediation and best practices when including Mobile Ads in your app or game.

Simon Howard (@SimonH109)

 

February 24, 2015

Simon Howard

The Amazon Appstore team will be in Barcelona, Spain from March 2nd to March 5th for Mobile World Congress. If you are in Barcelona for MWC, there are a number of ways that you can meet with the team and learn more about growing your business with the Amazon Appstore, Amazon devices, and the services we offer to developers.

Here’s where you can find us in Barcelona:

Mobile Premier Awards

Monday 2nd March – Sala Apolo, Carrer Nou de la Rambla, 4pm to 10pm

On the 9th edition of the Mobile Premier Awards, you'll see the latest global app innovations, from the 16 finalists representing 10 countries. Paul Cutsinger will be part of the judgeing panel, and our team will be there during the networking hour after the show to meet with you on this galactic evening! Get a free pass using code AMAZON at http://bit.ly/RegisterMPA

Applications Developer Alliance Mobile Apps Party

Tuesday 3rd March – W Hotel, Barcelona, 8pm to 12am

Join us at Barcelona’s beautiful W hotel for an evening of networking and fun. Amazon Appstore is one of the main hosts for this event and we’ll be hanging out and talking to developers about the Amazon Appstore, our developer SDKs and the services that we offer. We’ll have a number of Fire devices on display and several Fire TVs setup, so come along and play games such as Crossy Road, Ski Safari or Table Top Racing from our developers.  You’ll also have an opportunity to meet our business leadership team to chat about how you can grow your business and monetize on Amazon.  Or, connect with our Developer Evangelists (Simon Howard and Paul Cutsinger) to learn more at a technical level about how you publish your app to the Amazon Appstore. You can register for free by entering the code AmazonAppstore here.

Mobile Gaming Panel

Wednesday 4th March - Hall 4, Auditorium 2, Fira Gran Vira, 3:15pm

Join Amazon Appstore Director of Product Management, Aaron Rubenson, for a panel on Mobile Gaming.  Join some of the leading developers in the industry as they discuss how gaming will evolve on mobile in the coming years, why freemium is proving such an attractive model and the impact it has on developing compelling gaming experiences and which alternative models might prove fruitful in the coming years.  

Gamelab Mobile

Thursday 5th March - Hall 8.0, Theater D, Fira Gran Vira, 9am to 5pm

Gamelab Mobile is an exclusive conference that explores the Edge of Innovation in mobile gaming.  Discover how the latest advances in mobile and Internet technology are helping game developers to envision and create new playgrounds and forms of interactive entertainment.  During Paul Cutsinger’s keynote at 11:30 AM, learn how to generate new business opportunities by turning your game players into fans (more details below).  Drop by our Meet the Experts table, where Amazon representatives and guest speakers can provide feedback on your mobile and gaming projects.  If you happen to have your APK with you, we’ll have devices on hand for testing. 

Gamelab Mobile Keynote: How to Turn your Players into Fans

We’ve analyzed the top mobile games to see what best practices make them stand out from the crowd. Several trends emerging now will amplify those best practices and games will have more opportunity than ever to excel. In the future, the top games will have fully realized fan bases that will drive their user acquisition and engagement engines. That fan base will include players but also content creators, advocates and potential new customers – this will open up a wider range of monetization options.

In this talk at 11:30 AM in Hall 8.0 Theatre D, Paul Custinger (@PaulCutsinger) will reveal these trends and what the cutting edge games are doing today. He’ll also share specific ways game developers can use this information to evolve players into a fan base for a stronger launch, more engagement, more revenue and an extended game lifespan. This will give you concrete ideas to incorporate into your existing games and those that you create in the future.

So…

If you are in Barcelona for MWC, we would love to meet you to hear more about your app or game, so do come see us at one of the events that we are attending.

Simon Howard (@SimonH109)

 

February 03, 2015

Simon Howard

The Amazon Mobile Ads API allows you to monetize apps and games across the Android, Fire OS, and iOS platforms by displaying ads to customers in the US, UK, France, Italy, Spain, and Germany. Ads can be banner or interstitial and will advertise products or services coming from Amazon or other well-known brands. You are paid on ad impressions served whilst some other Ad networks only pay on clicks. To get more information on the benefits of using the Amazon Mobile Ad Network, check out the Success Stories.

This blog is about how you get started with using the Amazon Mobile Ads API in your Android Java based app or game that is running on an Android device, Amazon Fire OS tablet or phone device.

How Do I get Access to the APIs?

The Amazon Mobile Ads API is part of a single SDK (the Amazon Mobile App SDK, which you can download here) that also provides access to other Amazon mobile services and APIs such as GameCircle and In-App Purchasing.  The same download also includes the necessary files to use the Amazon Mobile Ads API in apps developed for iOS.

You can use the Android Java version of the Mobile Ads API in projects that have been created in Eclipse or Android Studio. First, download the SDK and extract the zip file to the appropriate location on your development machine. Here’s what the SDK folder looks like on my machine…

Obtain an Application Key

Before you can use the Amazon Mobile Ads API in an app, you should create an Application Key that is unique to the application. This key is used by the Amazon framework to identify your app so it’s essential that you use the correct one so that you will be paid.

To create a new key you need an Amazon Apps & Games Developer Portal account. If you don’t have one, you can create a free account by clicking here. Also note, because you will be receiving income into the account, you will need to add your payment and tax information details to your developer account profile.

You can bypass this step for now if you want to just try out the API using one of the sample apps. Just make sure you create your own key (and account) later.

Check out the Samples First

Before you start including the Amazon Mobile Ads API in your project, I recommend that you first build and play with the three samples that come with the SDK. You can find these samples in the /Android/Ads/Samples folder and they are as follows:

SimpleAdSample

Displays a banner ad and is a good introduction to the APIs

FloatingAdSample

Builds upon SimpleAdSample

InterstitialAdSample

Displays a full-screen interstitial ad

Building the Samples in Eclipse

To build the samples in Eclipse is pretty straightforward. Once you have imported the projects, you just need to add the mobile ads JAR file library to your project and ensure that the library file is included in the build process.  There are some good instructions in this Quick Start Guide about how to do this but do note that you need to check the JAR library file in the “Order and Export tab” so that it is included in the build. The screenshot below shows how to do this:

This step is quite easy to miss and unfortunately, if you don’t complete the step, the project will still build successfully but you will get runtime errors saying that methods in the API cannot be found!

Building the Samples in Android Studio

The Mobile Ads API samples were created using Eclipse but you can also use the samples in Android Studio very easily. As this is currently not described in the Quick Start Guide I’ve written some instructions below on how to do this…

  1. Run Android Studio and from the Quick Start pane select “Import Non-Android Studio project”. An import wizard begins
  2. Locate the Eclipse project folder for the desired sample and click “OK”

  1. In the “Import Project from ADT” dialog, first choose a destination directory for the Android Studio version of the project and click “Next”

  1. Various import options will appear in the same dialog – just click “Finish” to start the import

  1. Once the import has completed, the project will open in Android Studio
  2. To add the Amazon Mobile Ads API library file to the project, first create a folder called “libs” under the “app” folder in your project. Use OSX Finder or Windows Explorer (as applicable) to do this
  3. Next, find the file “amazon-ads-x.y.z.jar” which located in the “/ads/lib” folder within the Amazon SDK folder and copy it to your new “/app/libs” folder
  4. In Android studio, refresh the project view so that the libs folder appears

  1. Right click the .jar so that you see the context menu as shown below. Select “Add as library”

  1.  Click “OK” in the “Create Library” dialog that appears

  1. At this stage the library will have been added and you should see the following newly added lines in the build.gradle file under your ‘app’ folder:

dependencies {

    compile files('libs/amazon-ads-x.y.z.jar')

}

Where: x, y and z will be substituted with the actual version numbers

Running the Samples

Once you have added the library file to a sample project, you should be able to build the code and try it out on a device. In the SimpleAdSample project, for example, you should see something similar to this when it runs:

Including the APIs into Your Own Code

Using the Amazon Mobile Ads APIs in your own code is relatively straightforward and this Quick Start Guide goes through the steps that you need to follow. There are, however, a few things that are worth delving into a little deeper which I discuss below.

Additional Permissions

To use the APIs, you need to add a least one permission to the project’s manifest file. You have to add the permission android.permission.INTERNET as this enables the app to communicate with the ad server. Additionally, it is advisable to add the other permissions suggested in the Quick Start Guide as doing so will give the ad framework a better chance of delivering ads that are more relevant to the user - see also section “Loading the ad” below.

Loading the Ad

There are two main ways in which you can request an ad. The simplest way is just to call the version of the Ad object’s loadAd() method that takes no parameters. However, the problem with this approach is that you will get ads delivered to your app that might not be applicable to your user’s geographical location. A better approach is to use a different version of the same API that takes some parameters…

 final AdTargetingOptions adOptions = new AdTargetingOptions();       

 adOptions.enableGeoLocation(true);

 this.adView.loadAd(adOptions);

In the snippet above, the code uses the Mobile Ads API to send the position of the device to the Amazon Mobile Ad Network so that potentially more targeted ads are delivered to the host app. Note that the user may still choose to disable this feature by disabling location awareness on a system level in the device settings.

Debugging

During development, it’s a good idea to enable logging and testing using the associated methods in the AdRegistration class. Doing so will for example make it easier for you to track the messages sent to the ad framework in the logcat window. Just make sure to disable logging and testing before launching your app to production.

Handling Ad Events

Once an Ad object has been created, it’s possible to hook into events that are generated by the API. This is done via a special listener class from the Mobile Ads API called DefaultAdListener. When you do this, you can trap several events related to an ad and these result in calls to methods that you override. For example, the onAdFailedToLoad() method is called when the ad has failed to load and in that scenario you could determine the possible cause of the failure and if applicable choose to fill the advert using an alternative ad network.

See this article about event tracking and error handling for more details.

Conclusion

The Amazon Mobile Ads API provides you with additional ways in which you can monetize your mobile apps and games via ads relating to products or services that come from Amazon or other well-known brands. Integrating the API into your Android Java app or game is quick and easy. Once you have integrated the API, you are paid for ads on impressions rather than on clicks.

Here are some more links to useful articles on using the Amazon Mobile Ads API in your Android Java based app:

In upcoming blogs, I will discuss how you can use the Amazon Mobile Ad API in games or apps running on iOS and those that have been developed using popular frameworks such as Unity and Marmalade.

Simon Howard (@SimonH109)

 

Want the latest?

appstore topics

Recent Posts

Archive