0

If my unlocker app is valid it will be hidden in the Launcher. The unlocker app unlocks my app to PRO version.

Now I have two ideas:

  1. check if the unlocker app is visible or not
  2. check if the unlocker app has a valid play license

But I have no idea how to do that, and I don't want to use SharedPreferences because they are easy to modify, right?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
rala
  • 895
  • 2
  • 18
  • 43

1 Answers1

0

I did it this way now:

public static List<ApplicationInfo> getAllInstalledUnLaunchableApplications(Context context) {
    List<ApplicationInfo> installedApps = context.getPackageManager().getInstalledApplications(PackageManager.PERMISSION_GRANTED);
    List<ApplicationInfo> installedAppsFiltered = new ArrayList<ApplicationInfo>();
    for(int i =0; i<installedApps.size(); i++){
        if(context.getPackageManager().getLaunchIntentForPackage(installedApps.get(i).packageName) != null){
            //If you're here, then this is a launch-able app
            //launchableInstalledApps.add(installedApps.get(i));
        }else {
            //If you're here, then this is a unlaunch-able app
            installedAppsFiltered.add(installedApps.get(i));
            //Log.d(TAG, "launchable:not?:"+installedApps.get(i).name+":"+installedApps.get(i).packageName);
        }
    }
    return installedAppsFiltered;
}

In my app I have a license check like this

and if it is valid I hide it (in allow in an AlertDialog-Listener):

PackageManager p = getPackageManager();
p.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Log.d("Unlocker", "App hidden");
finish();

so you have to launch it!

I hope I could help someone with that (workaround)
so if you can check the license from an other app please let me now!

Community
  • 1
  • 1
rala
  • 895
  • 2
  • 18
  • 43