Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if an android app is a game?

Tags:

android

In an app I am developing I need to iterate through the installed apps and detect which ones are games. Is there any way to do this?

I was thinking to a Play Store API that can search for package name and returns its category even if it's only limited to apps on the store. Does something similar exist? Would it be possible?

Is there any alternative way to do it?

like image 617
Vektor88 Avatar asked Sep 19 '25 07:09

Vektor88


1 Answers

This answer is deprecated!
Correct and backwards compatible way to do this is here!

Since Android API version 21, there's finally a way to check if an application is a game.

PackageManager pm = mContext.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(mPackageName,0);
if((ai.flags & ApplicationInfo.FLAG_IS_GAME) == ApplicationInfo.FLAG_IS_GAME)
    return true;
return false;
like image 148
Vektor88 Avatar answered Sep 21 '25 21:09

Vektor88