brig
brig

Reputation: 3773

How to get back the result once make a call in android

I am trying to make MO call from my code. For that I am using below code.

                            String phnum = "1234567892";
                            Intent callIntent = new Intent(Intent.ACTION_CALL);
                            callIntent.setData(Uri.parse("tel:" + phnum));
                            startActivityForResult(callIntent,5);

Also I need to get the results like whether my call is fail , pass , dropped etc information.

For that I am trying the get the results from the below method.

public void onActivityResult(int requestCode, int resultCode, Intent data) { 
        if ( requestCode == 5 ) { 

                Log.i(TAG,"resultCode.."+resultCode);

                } 
            } 

Above code returning only '0' every time and that too its not consistent(Some time my "onActivityResult" is not getting called.

Please let me know if it's the right way to get the what I want or do I need to try some other mechanism.

Upvotes: 0

Views: 40

Answers (1)

droid
droid

Reputation: 414

You have to use PhoneStateListener to get the status of the call. In this link you will get how to use it.Here is another question link relating this , you will get some idea.

Upvotes: 1

Related Questions