简体   繁体   中英

Unique ID of Android app

What is the unique id of android application? Is it package name? Can there be two applications with the same packages names on one device?

There are 2 different things: the Java package and the Android Application package. The second one needs to be Unique.

There is a good article about it here

Yes, the package name is the unique identifier for an android application in the market.

No, there can't be two apps with the same package name in the market/on the device.

I'd like to add one little clarification that wasn't mentioned here.

Although there can't be two apps with the same package name, there can be several launcher activities within one app that user can see in launcher app. For example, standard "Maps" application ("com.google.android.apps.maps" package) has several launcher activities like "Local", "Navigation", "Maps". It doesn't matter for user if these "apps" (or activities, in developer terms) are implemented in one application package or not.

Activity name ("com.google.android.maps.MapsActivity") is not unique itself too, because anyone can create an app with unique package name and an activity located in java package com.google.android.maps called MapsActivity.

Thus, if you want to find unique identifier for all these launcher activities, you should use combination of both app package name ("com.google.android.apps.maps") and activity name ("com.google.android.maps.MapsActivity").

The unique identifier for Android apps is now the applicationId field in the build.gradle file. Devices will determine whether an app is an update to an existing app or a new app based on that field.

包名必须不同,您不能像现有应用程序一样上传包名相同的应用程序。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM