如何获取Android应用程序ID? [英] How to get Android application id?

查看:530
本文介绍了如何获取Android应用程序ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 (<一href="http://developer.android.com/reference/android/content/Context.html#getPackageName%28%29">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:

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

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

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

这篇关于如何获取Android应用程序ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆