How to get Android application id?

后端 未结 13 641
失恋的感觉
失恋的感觉 2020-12-07 18:26

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?

13条回答
  •  萌比男神i
    2020-12-07 18:44

    If you are using the new** Gradle build system then getPackageName will oddly return application Id, not package name. So MasterGaurav's answer is correct but he doesn't need to start off with ++

    If by application id, you're referring to package name...

    See more about the differences here.

    ** not so new at this point

    ++ I realize that his answer made perfect sense in 2011

提交回复
热议问题