如何获取Android应用程序ID?应用程序、Android、ID

2023-09-12 06:23:19 作者:空城.

在Android的,我怎么了应用程序的编程ID(或其他方式),并使用该ID与其他应用程序我该怎么沟通?

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?

推荐答案

如果按应用程序ID ,你指的是包的名称,您可以使用的方法上下文:: getPackageName (http://http://developer.android.com/reference/android/content/Context.html#getPackageName%28%29).

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:

在启动的其他应用程序的活动,并在其他的故意​​之发送数据 发送一个广播的具体行动/类别和演员发送数据 如果你只需要共享的结构化数据,使用内容提供商 如果其他应用程序需要的背景下,利用服务器的连续运行和绑定自己的服务。

如果您能详细阐述您的具体要求,社会各界将能帮助你更好的。

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

 
精彩推荐
图片推荐