Basically I'd like to start the current phone call ui from a button in one of my activities
.
So far, I've been able to start a new call using
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:000000"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
or to move to the phonebook using:
Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
I've also tried to use that code, but it seems not to be working on HTC devices and some Huawei (ri
is null
).
Intent intentToResolve = new Intent(Intent.ACTION_MAIN);
intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER);
intentToResolve.setPackage("com.android.phone");
ResolveInfo ri = getPackageManager().resolveActivity(intentToResolve, 0);
if (ri != null)
{
Intent intent = new Intent(intentToResolve);
intent.setClassName(ri.activityInfo.applicationInfo.packageName, ri.activityInfo.name);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
What I'd like to get is move directly to the call ui. The behaviour is the same as in this procedure:
- Be in a phone call
- Go back to the Home screen
- Expand the notification bar
- Click on the call row
I don't know how to achievve and how to make it works on all devices.
Thanks for your precious help.