Some people want to know that time when the phone is calling.
You've to add the following line on AndroidManifast.xml.
[sourcecode language="xml"]

[/sourcecode]
This is java source code.
[sourcecode language="java"]
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
private PhoneStateListener phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
if (state == TelephonyManager.CALL_STATE_RINGING) {
// To do what you want to do
}
}
};
private TelephonyManager telephonyManager = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_call_android);
telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
[/sourcecode]