What I want to archive is that when user click number which appears to be phone number, USSD code or has the ability to be used by dialer, the phone should list apps for the user to choose which application to use when making the call and let user choose which app to be default for in future.
AM just beginner to android I tried searching but I can't find any related question and I don't know where to start.
The other question is the operation result on onNewIntent
or onActivityResult
Thanks.
You want to use implicit intent:
// build intent
Uri number = Uri.parse("tel:5551234"); // replace 5551234 with your number
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
// Verify it resolves
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(callIntent, 0);
boolean isIntentSafe = activities.size() > 0;
// Start an activity if it's safe
if (isIntentSafe) {
startActivity(callIntent);
}