1

I want to replace the outgoing screen and make call through that custom screen. I succeed to bring custom screen but I could not make calls. If I use ACTION.CALL then it call the Default outgoing screen.

public class OutgoingCallBroadcastReciver extends BroadcastReceiver {
    Context c;
    public OutgoingCallBroadcastReciver() {

    }

    @Override
    public void onReceive(final Context context, final Intent intent) {
        final String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
        c=context;
        setResultData(null);
        setResultData(number);
        callActionHandler.postDelayed(runRingingActivity, 1000);

    }

    Handler callActionHandler = new Handler();
    Runnable runRingingActivity = new Runnable(){

        @Override
        public void run()
        {
            Intent intentPhoneCall = new Intent(c, OutgoingScreen.class);
            intentPhoneCall.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intentPhoneCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            c.startActivity(intentPhoneCall);
        }

    };
}
Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Sameer Yadav
  • 63
  • 1
  • 5
  • Possible duplicate of [How to make my own custom dialer in an Android phone](http://stackoverflow.com/questions/10303138/how-to-make-my-own-custom-dialer-in-an-android-phone) – hazardous Jan 04 '16 at 09:07

1 Answers1

0

For outgoing calls I make custom work around and created custom permission of outgoing reciever in manifest.

I had called the activity after a delay using handler.

Hope i will work for you.

Please check the below code.

@Override
public void onReceive(Context context, Intent intent) 
{
    mcontext = context;
    setResultData(null);
    dialphonenumber = getResultData();
    if dialphonenumber == null)
    {
        dialphonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
    }
    setResultData(dialphonenumber);
    callActionHandler.postDelayed(runRingingActivity, 1000);
}


Handler callActionHandler = new Handler();
Runnable runRingingActivity = new Runnable() 
{
    @Override
    public void run() 
    {

        Intent intentPhoneCall = new Intent(mcontext, OutgoingCallActivity.class);
        intentPhoneCall.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intentPhoneCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mcontext.startActivity(intentPhoneCall);
    }
};

Hope it will work for you.

Let me know if you have any issue.

Vatsal Shah
  • 547
  • 3
  • 9
  • thanks vatsal i am done with this. but now i am facing problem in incoming screen. i gave the 1 sec delay but it could not override default screen. it opens behind it. i am running it in xolo phone. – Sameer Yadav Jan 06 '16 at 09:53