-2

Is there a way of knowing what other apps either users have open or have installed on their phone through my own app?

For example: I have a shop that sells toys and my app can check if the user is currently running or have installed something like PokemnGo. Then I can personalize my shop for them with Pokemn related products.

This would be across both IOS and Android (either/or)

Would this be a breach of privacy? (will ask at installation anyway)

Stary
  • 1
  • Unfortunately it isn't always a good idea to ask a single question that covers both iOS and android since the answers will be different. The answer on iOS is no (thankfully) – Paulw11 Feb 01 '17 at 12:54
  • Thats true but I need to develop both apps for both platforms...So there is no way of tracking app installs or active apps on IOS? – Stary Feb 01 '17 at 13:11

3 Answers3

0

You can get the list of package names of all the installed apps using :

Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

You can iterate through pkgAppsList to search for your desired apps.

To get the list of all the running apps use:

ActivityManager actvityManager = (ActivityManager)
this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> runningProcesses = actvityManager.getRunningAppProcesses();
nishith kumar
  • 981
  • 7
  • 20
0

You can use PackageManager.getInstalledApplications() and PackageManager. getInstalledPackages() to get the list.

Doc for PackageManager

xizzhu
  • 895
  • 6
  • 9
0

For Android, there are methods for doing this, as others have noted, using the PackageManager and ActivityManager.

Unfortunately, on iOS, there's no way to do this that won't get you rejected by Apple from the app store. There are methods that may work if your app is internally distributed and doesn't need to go through Apple's review process (ad-hoc / enterprise apps). See more details here.

Community
  • 1
  • 1
wottle
  • 13,095
  • 4
  • 27
  • 68