caw
caw

Reputation: 31489

Uniqueness of sharedUserId in Android

If you don't set a sharedUserId in Android, a unique one is automatically assigned to the application, according to the Android documentation.

But in what way is the sharedUserId unique? Is it only unique to the application, i.e. does an application have the same sharedUserId on all devices? This would mean that you can find it out for one installation programatically and use that value for a second app.

Or is the ID a random value that is different on every single device?

Upvotes: 3

Views: 488

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

But in what way is the sharedUserId unique?

All Linux user accounts are unique. android:sharedUserId says that 2+ apps, signed by the same signing key, should share a Linux user account. By default, they each get their own Linux user account.

does an application have the same sharedUserId on all devices?

It has the same android:sharedUserId value wherever you choose to use it. The Linux user account, though, will be different for different devices.

Or is the ID a random value that is different on every single device?

I wouldn't say "random", as I do not know the precise algorithm that is used to choose the number.

Upvotes: 2

Related Questions