I have a receiver that starts when any application is uninstalled. I want to get the application UID. Currently, I got the name of the package that was deleted, but when I try to get the UID, it returns null. I am currently getting the UID of any package from the following code.
public String getID(String pckg_name) { ApplicationInfo ai = null; String id = ""; try { ai = pm.getApplicationInfo(pckg_name, 0); id = "" + ai.uid; } catch (final NameNotFoundException e) { id = ""; } return id; }
source share