'popup window when user dial a number in java

i have a code that shows popup window when ringing phone (incoming call)

what can i do for show same popup when user dial a number via phone (outgoing call)

thats my working code details for incoming call

public class callReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
         String number = null;
String giden="no";

        if(state==null)
        {
            //Outgoing call
             number=intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
            
        }
        else if (state.equals(TelephonyManager.EXTRA_STATE_RINGING))
        {
            //Incoming call
             number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);

        }

        try {

            if(state.equals(TelephonyManager.EXTRA_STATE_RINGING) ){
                Toast.makeText(context,"Arayan Numara: " + giden, Toast.LENGTH_SHORT).show();

                Intent serviceIntent = new Intent(context,PopUp.class);

                serviceIntent.putExtra("number", number);
                if (number.length()>1) {
                    context.startService(serviceIntent);
                }
            }
        }
        catch (Exception ignored){

            if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
                try {
                  popup2.enqueueWork(context,new Intent(),number);
                }catch (Exception e){

                }
            }

            

        }

    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source