Search code examples
androidandroid-intentandroid-contacts

Is there an intent for showing the address book app ?


As simple as the question. I'd like to know if there is a common intent to show the contacts app, so that the user could see the contacts list.

I've noticed there are intents for picking a contact, showing a contact, add and edit a contact, but all of those are for a single contact (all written here)...

I guess I could query one of those intents, and see which app handles it, and just launch it, but is there maybe a better way?


Solution

  • OK, found the answer using "pskink" user's comment:

    startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_CONTACTS));
    

    However, the IDE warns that it requires API 15 and above. I wonder how it worked before. For example, how launchers showed an app icon for this, knowing which app would open it.


    EDIT:

    For previous versions of Android, you can use:

    startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("content://contacts/people")))