Search This Blog

Saturday, 15 December 2012

How to get the call details from PhoneListener

  
So here is the one how to get the call details and send it to somewhere on remote database.

CODE:

As i mentioned earlier how to integrate PhoneListener:

here are the functions to over ride in Phone Listener , you may override any function as the name suggests when these functions will be called...
Create these variables in class:
PhoneCall _phoneCall;
String _phoneNumber;
int _callduration;



first add your phone listener:
                                Phone.addPhoneListener(this);

now,

ii  am getting call details when the call is incoming....

_phoneCall = Phone.getCall(CallID);
if(_phoneCall!=null){
    _phoneNumber = _phoneCall.getDisplayPhoneNumber();
}

              
Now as you can see i am just getting the details here nothing else;

in CallDisconnected function:
if(_phoneCall!=null){
_callDuration = _phoneCall.getElapsedTime();
}
//Call function to send data to server.....use invokeLater for this ...


Regards.

No comments:

Post a Comment