I want to get uid of whatsapp in android, and I know Whatsapp's package name. How can I do this? Thank you.
Use android. os. Process. myUid() to get the calling apps UID directly.
There are several ways to know your Android Device ID, 1- Enter *#*#8255#*#* in your phone dialer, you'll be shown your device ID (as 'aid') in GTalk Service Monitor. 2- Another way to find the ID is by going to the Menu >Settings > About Phone > Status.
You can't do this. Each Android application has a package name, which effectively defines the Java/Dalvik namespace that its classes occupy. You cannot have two packages of the same name installed because it would create overlapping namespaces, which is why it always replaces the old one when you install a new one.
You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com. example.
I found WhatsApp's uid with the following code
int uid = 0;
try {
uid = this.getPackageManager().getApplicationInfo("com.whatsapp", 0).uid;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With