0

I have a Little app to make in Android.

So I have few Button and each button call a specific intermediate number first. After this first call I have to wait ~15seconds and the app have to call the true number.

for example, I click on a button named "toto" and is telephone number is 001 so the app first make a call to the intermediate number which is for example 000 and there will be a voice saying that he has to wait few seconds before reach toto.

For now I have this :

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

TelephonyManager telephoneM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        PhoneStateListener listner = new PhoneStateListener() {

            public void onCallStateChanged(int state, String incomingnumber) {
                String etat = "N/A";
                switch (state) {
                case TelephonyManager.CALL_STATE_IDLE:
                    etat = "pas de reponse";
                    Toast.makeText(MainActivity.this, "" + etat,
                            Toast.LENGTH_SHORT).show();
                    break;
                case TelephonyManager.CALL_STATE_RINGING:
                    etat = "sonne";
                    Toast.makeText(MainActivity.this, "" + etat,
                            Toast.LENGTH_SHORT).show();
                    break;
                case TelephonyManager.CALL_STATE_OFFHOOK:
                    etat = "en ligne";
                    Toast.makeText(MainActivity.this, "" + etat,
                            Toast.LENGTH_SHORT).show();
                    break;
                }
            }
        };
telephoneM.listen(listner, PhoneStateListener.LISTEN_CALL_STATE);

Btoto = (Button) findViewById(R.id.num1);
Btoto.setOnClickListener(this);

public void onClick(View v) {

        switch (v.getId()) {
        case R.id.num1:
            Intent localIntent = new Intent("android.intent.action.CALL");
            localIntent.setData(Uri.parse("tel:0153204255")); // the intermediate number
            startActivity(localIntent);
//here I have to make a delay after the first ringing

// And here i have to make the real call to toto

            break;

Can someone give me some advice please ?

Thank you

Nemka
  • 100
  • 11
  • similer to this question is posted here http://stackoverflow.com/questions/21252657/interrupt-incoming-call-in-android – Ravi Bhandari Jan 29 '14 at 11:56
  • Thanks for you help but it's not very what I expected... I want my app call a number and after few seconds call another number... Anyone can help please ? – Nemka Jan 29 '14 at 14:09

0 Answers0