0

Possible Duplicate:
How to get package name from anywhere?

In my project I have selected an application from installed applications in the phone and stored it as a string. But later in the project I need to launch that application for which I need d package name. Is it possible to get name of the package from application name?? Please help. Thanks in advance

Community
  • 1
  • 1

1 Answers1

1

The package is the only official identity of an application. If you using anything to be a persistent identity of an app, it should be that, not some something else. (You are not clear on what you are currently using, but if by "application name" you mean the label that is shown to the user for the application, that is most definitely not what you should be doing. All the user needs to do is change their locale and poof you are lost. Or install an update to the app that changes its name... like Google Music becoming Play Music.)

hackbod
  • 90,665
  • 16
  • 140
  • 154
  • Could you please tell me how I can store both application name(label) and the package name so that i can use it later? i need label to display it on the screen for the user and package name to launch it – divya nayak Mar 21 '12 at 21:40
  • 2
    You only need the package name. If you want the label, use http://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationInfo(java.lang.String,%20int) and http://developer.android.com/reference/android/content/pm/PackageManager.html#getApplicationLabel(android.content.pm.ApplicationInfo) . You definitely don't want to store the label text, because it can change for all kinds of reasons -- an application update being installed, the user changing the locale, etc. – hackbod Mar 30 '12 at 05:46