2

When I get incoming call on my mobile that time I want to ask user to select action like "In which app they wants to pickup that call".

Normally as per my research when I use android:permission="android.permission.CALL_PHONE" action for my receiver then It will automatically open "Complete action using" but unfortunately not getting that popup.

To open that popup, I have done below code

Intent it = new Intent(Intent.ACTION_CALL);
it.setData(Uri.parse("tel:" +number));
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

if (ActivityCompat.checkSelfPermission(ctx,
        Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
    return;
}
ctx.startActivity(it);

And using that code "Complete action using" popup is open but not getting my app in that selection

I refer below link to make my scenario working how to use android.intent.action.CALL_PRIVILEGED and android.intent.action.NEW_OUTGOING_CALL?

So can any one please help me to make my scenario working?

Himadri
  • 187
  • 2
  • 3
  • 13
  • I'm confused. Do you want to handle incoming calls or outgoing calls? These are 2 different things and your question contains elements of both. – David Wasser Jul 28 '17 at 14:48
  • @David I want to handle incoming calls – Himadri Jul 29 '17 at 06:20
  • Did you look at this? https://stackoverflow.com/questions/15563921/how-to-detect-incoming-calls-in-an-android-device Incoming call detection is handled by using a `BroadcastReceiver` to detect changes in the phone state. Your question talks about "complete using action" popup, but this would only be applicable for an `Activity`. – David Wasser Jul 29 '17 at 06:39
  • I have already setup Broadcast Receiver to detect incoming call phone state My scenario is like that whenever I get incoming call in my mobile that time I want to ask to user "In which app they wants to redirect their call?" using "Complete action using" popup – Himadri Jul 29 '17 at 09:56

1 Answers1

1

ACTION_CALL is used for an OUTGOING call, not an incoming call. I am not sure you can actually do what you want. You would somehow need to "hold" the incoming call while you ask the user what app should answer it. However, answering an incoming call is done in a BroadcastReceiver, not in an Activity.

You can look at some of the answers in this question. This person is trying to do something similar (show another Activity over the default incoming call screen). Even this seems to be difficult.

And here is a pretty complete explanation of what happens when an incoming call arrives.

David Wasser
  • 93,459
  • 16
  • 209
  • 274