Android open phone call application

android, launch, launcher, phone-call

Solution

`Intents` are intended (no pwn intended here (damn!)) to give you a more generic way of accessing actions such as opening a file. If you had to specify the package of whatever you wanted to do this would be very limited. However, here are some of the intents that may be what you're after.

//For the contacts (picking one)
 Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
//For the contacts (viewing them) 
 Intent i = new Intent(Intent.ACTION_VIEW, ContactsContract.Contacts.CONTENT_URI);
//For the dial pad
 Intent i = new Intent(Intent.ACTION_DIAL, null);
//For viewing the call log
 Intent i = new Intent(Intent.ACTION_VIEW, CallLog.Calls.CONTENT_URI);

Make yourself a `useful intents` file somewhere to save you time in the future, you'll thank me later someday.

Of course to start those intents you'd do `startActivity(i);` for all excepting the first one, since you'd want the contact back and you'd need `startActivityForResult(i);` but that's another story.

Problem

I just want to open phone call application of android device. I dont want to provide that application a phone number. Just want to open it. I am using phone application's package name to open it. Because I am able to open any application I want through that package name with the code below. `Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.contacts"); startActivity(launchIntent);` I am not able to open Phone and Contacts application with the above code. What can be the problem?

Original source