Alex
Alex

Reputation: 887

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?

Upvotes: 8

Views: 18829

Answers (5)

Nanne
Nanne

Reputation: 64429

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

Upvotes: 12

James
James

Reputation: 641

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.

Upvotes: 2

Andrei Buneyeu
Andrei Buneyeu

Reputation: 6680

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").

Upvotes: 2

Master C
Master C

Reputation: 1546

Package name must be different, you can't upload an app with same package name like an existing one.

Upvotes: 1

WarrenFaith
WarrenFaith

Reputation: 57702

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.

Upvotes: 3

Related Questions