Skip to main content

ADVANCED

How to detect store installation?

When distributing your app through alternative channels outside of official app stores (like Google Play Store or Apple's App Store), you may need to detect where your app was installed from. This is particularly important for:

  • Implementing different payment flows for alternative distribution channels
  • Adjusting app behavior based on the installation source
  • Ensuring compliance with platform-specific requirements
  • Managing features that should only be available in certain distribution channels

To detect whether the game is running in alternative distribution (outside official app stores), use the snippets below:

Below are helper snippets you can use to adjust your app's behavior depending on various factors like the installer's package name, Google Play Store's country code, etc.

How to check if Google Play Store is installed?​

Can be useful in scenarios, when a part of functionality shouldn't even be attempted to be run outside Google Play Store ecosystem. This snippet will allow you to determine, if the device has Google Play Store installed.

if (XsollaStoreClientInfo.IsGooglePlayStoreInstalled())
{
Debug.Log("Google Play Store found!");
}
else
{
Debug.Log("Google Play Store NOT found!");
}

Checking if the App is Installed from Google Play Store​

This snippet helps to determine whether the app was installed directly from the Google Play Store or side-loaded (e.g. installed from an APK).

if (XsollaStoreClientInfo.IsInstalledFromGooglePlayStore())
{
Debug.Log("App was installed from Google Play Store");
}
else
{
Debug.Log("App was NOT installed from Google Play Store");
}

Querying the installer's package name​

If you need to know the exact package name of your app's installer, use the following code below.

var installerPackageName = XsollaStoreClientInfo.GetInstallerPackageName();

var matched = installerPackageName.Equals("com.xxx.yyy.zzz", StringComparison.OrdinalIgnoreCase);

if (matched)
{
Debug.Log($"Expected installer package name: {installerPackageName}");
}
else
{
Debug.Log($"Unexpected installer package name: {installerPackageName}");
}

Or if you prefer a simplified approach, where you don't care about the actual installer's package name, use this code:

var matched = XsollaStoreClientInfo.IsInstallerPackageName("com.xxx.yyy.zzz");

if (matched)
{
Debug.Log("Expected installer package name found!");
}
else
{
Debug.Log("Expected installer package name NOT found!");
}