Tip: Rate My App – AIR style

Working on a mobile game or app with AIR mobile, one of the common tasks is putting a rate alert box – some sort of rating request that prompts the user to leave a review on the App store. This can be something like this:

One way to achieve that would be with a native extension (ANE).  There are also plenty of examples of how to code it in native Android or iOS, but with AIR we want to address all platform with the same code, if possible.

I will show an easy way to do just that  in your AIR mobile app with just plain old AS3, and handle both Apple and Google app stores.

The first part is showing the prompt. Just use your favourite UI component or your own popup skin to create and show a popup with two buttons. You are not restricted to UIKit style or Android style – I always like to customize it the same style of the game/app.

Next, we need to get the App id for the app store. In the case of iOS, this would be the ‘AppStore ID’ provided when you submit your app – a numerical ID. To find it, log into iTunesConnect and go to ‘Manage Your Applications’ and select your app. This will show a page like this:

In the details page above, the Apple ID value (numerical) is the ID required.

For Android we use Google Play store ID. This is more straight forward –  just use the app ‘id’ declared in your AIR app.xml (in the id tag). However, the ADT adds an ‘air’ prefix to the id, so this would be something like ‘air.com.mydomain.myapp’.

On the click handler for the ‘rate’ button place a call:

    // handle 'rate'

The app store page is accessible from the app simply by navigating to the right URL. When run on the device, this will open the App Store (or Play store) right on the app page, so the user can place a review.

	// App ID - Replace with your app id
	private static const APPLE_APP_ID:String= "123456789";
	private static const PLAY_APP_ID:String= "air.com.domain.mygame"; 
	// Store URIs
	private static const PLAY_STORE_BASE_URI:String= "market://details?id=";
	private static const PLAY_REVIEW:String= "&reviewId=0";
	private static const APP_STORE_BASE_URI:String= "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?onlyLatestVersion=false&type=Purple+Software&id=";
	// Open the review page in the app store
	public function openRatePage():void
	    var appUrl:String = APP_STORE_BASE_URI + APPLE_APP_ID;
	    if (isAndroid()) {
	    // Open store URI 	
	    var req:URLRequest = new URLRequest(appUrl);
	public function isAndroid():Boolean
	    return Capabilities.manufacturer.indexOf('Android') > -1;

That is all.
Note that the code will not work when running on desktop (simulator), so you will need to create a build and install it on a device to actually test it.

Another common problem is that the app is not yet in the store, or not yet submitted, so the app page will not be found. The simple way around it is to borrow an ID from another app  that’s already in the store and use it for testing. For example, Temple Run (Apple ID: 420009108, Google ID: com.imangi.templerun).
Once everything is working, place back your app ID before making the final build.

6 thoughts on “Tip: Rate My App – AIR style

  1. @flash-bob,
    this is just a parameter added to the store URL so that the page will open on the review tab.

  2. Hello Flexwiz,

    Do you know aswell how to get the newest comment directly.
    &reviewId=0 open on the review tab
    but it seems that &reviewSortOrder=0 1 or 2 doesnt allow me to have directly the newest comment

    Would you have any idea how to do this ?

    Thanks in advance

Comments are closed.