public class YourApplicationPhoneStateListener extends PhoneStateListener
{
@Override
public void onCallStateChanged (int state, String incomingNumber)
{
/* state can be any of the following:
TelephonyManager.CALL_STATE_IDLE
TelephonyManager.CALL_STATE_RINGING
TelephonyManager.CALL_STATE_OFFHOOK
*/