How to open Appstore in Unity? (iOS and Android)

How to open Appstore in Unity for iOS and Android? And how to not leave app when doing it?

You can just download my NativeAppstore.unitypackage, and import it into your project. (I haven’t wrote about the nitty gritty of creating Unity plugins yet, so this post will not go into the iOS or Android codes)

You can take a look at AppstoreTestScene.cs:

using UnityEngine;
using System.Collections;

public class AppstoreTestScene : MonoBehaviour 
    public string m_appID_IOS = 840066184;
    public string m_appID_Android = com.orangenose.noone;

    public void OnButtonClick(string buttonName)
        if(buttonName == ViewApp)
                #if UNITY_IPHONE

                #if UNITY_ANDROID
            } else
            {    Debug.Log(AppstoreTestScene:: Cannot view app in Editor.);

Pass your iOS and Android ID to AppstoreHandler (which is a Singleton), and it will be in charge of opening your Appstore for you.

For iOS, I use SKStoreProductViewController when its available, and if it’s not it defaults back to OpenURL (that unfortunately will pop you out of your app).

For Android, I use Uri Intent.

They are modal views, which means that it will not pop you out of your app. For iOS, just click Cancel, while for Android, just click Back Button to go back to your Unity scene.

IMG_7666 Screenshot_2014-12-02-22-10-30

When can you use this? For example, you want your players to rate your app, or you want to cross sell another of your apps.

All the codes are available on Github:

By the way, the Apps shown in the tutorial is Toughest Game Ever 2, which is available for iOS and Android, and I’m part of the team that made the game. So please check it out, download, show us some love?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s