0

I want to make a dialer app that will take phone number from the user. and will dial suppose *789*phone_number# how can make this . I've so far done this...

Button call;
Intent callIntent = new Intent(Intent.ACTION_CALL);
String pnd;




call = (Button) findViewById(R.id.button5);

OnClickListener req = new OnClickListener() {
        @Override
        public void onClick(View p1) {
            {
                pnd = Uri.encode("#");
                callIntent.setData(Uri.parse("tel:*2" + pnd));
                startActivity(callIntent);
            }
        }
    };
    call.setOnClickListener(req);
Sawpno
  • 85
  • 1
  • 2
  • 10

1 Answers1

0

Try to use action dial instead of action call? It won't place the call but it will bring up the dialer with the number pre-populated.

        Intent i = new Intent(Intent.ACTION_DIAL);
        i.setData(Uri.parse("tel:23456234#313"));
        startActivity(i);
Phuong Nguyen
  • 909
  • 7
  • 20
  • no , I want to take the phone number from the user and dial the number adding a *and a # – Sawpno Jul 16 '15 at 18:11
  • Ah you just need to intercept the new call broadcast and alter the dial string in that case. So user can use whatever dialer they want – Phuong Nguyen Jul 16 '15 at 18:13
  • I want that user will only give the number and the apps will automatically dial including * and # – Sawpno Jul 16 '15 at 18:23
  • suppose that user input number is 456987 then the aps will dial *456987# while pressing the call / dial button – Sawpno Jul 16 '15 at 18:24
  • Do you want to do the modification only when user is using your app? or do you want to do it on every call. If it is the later, then catching the broadcast is easier. – Phuong Nguyen Jul 16 '15 at 21:14