Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Android application id?

Tags:

android

In Android, how do I get the application's id programatically (or by some other method), and how can I communicate with other applications using that id?

like image 765
arams Avatar asked Aug 12 '09 05:08

arams


People also ask

How do I get an Android app ID?

Method 1: Find Android device ID using dial pad code Open your phone's dial pad, usually named “Phone” in the apps drawer. 2. Here dial this code *#*#8255#*#*. As soon as you will enter the last digit, Gtalk Service Monitor will open up and show your Android device ID along with your email.

What is the application ID?

Application ID means an application identifier used to tag specific routing applications within the Customer'sRouting Plan.

How do I get an APK ID?

You can use Analyze APK... from the Build menu in Android Studio, it will display the package name at the top of new window. Show activity on this post. If you just want to know package name, run adb logcat, launch the activity you want , you will get a hint on the package name.

Is application ID and package name same?

The applicationId exactly matches the Java-style package name you chose during project setup in android studio. However, the application ID and package name are independent of each other beyond this point.


8 Answers

If your are looking for the value defined by applicationId in gradle, you can simply use

BuildConfig.APPLICATION_ID 
like image 92
Jeremie Avatar answered Oct 02 '22 15:10

Jeremie


If by application id, you're referring to package name, you can use the method Context::getPackageName (http://http://developer.android.com/reference/android/content/Context.html#getPackageName%28%29).

In case you wish to communicate with other application, there are multiple ways:

  1. Start an activity of another application and send data in the "Extras" of the "Intent"
  2. Send a broadcast with specific action/category and send data in the extras
  3. If you just need to share structured data, use content provider
  4. If the other application needs to continuously run in the background, use Server and "bind" yourself to the service.

If you can elaborate your exact requirement, the community will be able to help you better.

like image 32
gvaish Avatar answered Oct 02 '22 17:10

gvaish


i'm not sure what "application id" you are referring to, but for a unique identifier of your application you can use:

getApplication().getPackageName() method from your current activity

like image 44
reflog Avatar answered Oct 02 '22 17:10

reflog


For getting AppId (or package name, how some says), just call this:

But be sure that you importing BuildConfig with your app id packages path

BuildConfig.APPLICATION_ID 
like image 28
Mopto Avatar answered Oct 02 '22 17:10

Mopto


Package name is your android app id .

String appId = BuildConfig.APPLICATION_ID

Or

https://play.google.com/store/apps/details?id=com.whatsapp

App Id = com.whatsapp

like image 41
Raviraj Avatar answered Oct 02 '22 16:10

Raviraj


Else you can get id of process your application runs in:

final static int android.os.Process.myPid()
Returns the identifier of this process, which can be used with killProcess(int) and sendSignal(int, int).

like image 28
Tony Frolov Avatar answered Oct 02 '22 15:10

Tony Frolov


I am not sure what you need the app/installation ID for, but you can review the existing possibilities in a great article from Android developers:

  • http://android-developers.blogspot.com/2011/03/identifying-app-installations.html

To sum up:

  • UUID.randomUUID() for creating id on the first time an app runs after installation and simple retrieval afterwards
  • TelephonyManager.getDeviceId() for actual device identifier
  • Settings.Secure.ANDROID_ID on relatively modern devices
like image 29
youri Avatar answered Oct 02 '22 17:10

youri


Step 1: Open the Google Play Store

Step 2: Open any App in App Store Example: facebook

Step 3: Click on any App and Look at the Browser link and At the End id=com.facebook.katana&hl=en will be there and this is your Apps Unique Id.

like image 30
Amrit Raj Avatar answered Oct 02 '22 17:10

Amrit Raj