tags:

views:

1492

answers:

3

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?

A: 

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

Reflog
each installed application have an unique id...is it possible to get an application's unique id from other application
arams
A: 

The PackageInfo.sharedUserId field will show the user Id assigned in the manifest.

If you want two applications to have the same userId, so they can see each other's data and run in the same process, then assign them the same userId in the manifest:

android:sharedUserId="string"

The two packages with the same sharedUserId need to have the same signature too.

I would also recommend reading here for a nudge in the right direction.

Will
2 different application use the same package name means, the applications can share the data?...
arams
No. If two applications have the same shareUserId AND are signed with the same signature the can share data. Package name is not an issue.
Will
A: 

How do I sign my two application with the same signature.? Can any 1 help please.? Thanks in advance.. :)

Vishal