Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. String your app_selected = "your package name";
  2. final PackageManager pm = getPackageManager();
  3. //get a list of installed apps.
  4. List<ApplicationInfo> packages = pm.getInstalledApplications(
  5. PackageManager.GET_META_DATA);
  6. int UID;
  7. //loop through the list of installed packages and see if the selected
  8. //app is in the list
  9. for (ApplicationInfo packageInfo : packages) {
  10. if(packageInfo.packageName.equals(app_selected)){
  11. //get the UID for the selected app
  12. UID = packageInfo.uid;
  13.  
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement