Reputation: 259
i am working on this admin/user lockscreen application. What this application entails is that if the admin (to be identify by his pin/password) tries to unlock the screen, it gives the admin access to all applications installed on the phone, while other users (to be identify by his pin/password) tries to unlock the screen, it gives them access to specific applications. i have already both the lockscreen and launcher for my application. But i got stucked at how to handle the launcher for both admin and user.
Android does not allow switching launcher activities programmatically, so this idea is out of place. so i figured out that i need to programmatically refresh the list of installed application for user (non- admin) to pick only the specific authorised application by the admin. So my question is, how can i refresh list of installed application after the user unlocks the screen and pick only specific applications that will be shown to the user?
Upvotes: 1
Views: 380
Reputation: 103
To obtain a list of all installed apps use PackageManager:
PackageManager packageManager = getPackageManager();
List<PackageInfo> packs = packageManager.getInstalledPackages(0);
for(int i=0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
ApplicationInfo a = p.applicationInfo;
// check if app is suitable for the user
}
Upvotes: 1