I need programming help to answer the calls in android.
You can be notified of an incoming call by using a PhoneStateListener
and implementing onCallStateChanged(int,String)
. There are 3 states, CALL_STATE_IDLE, CALL_STATE_RINGING and CALL_STATE_OFFHOOK
You will also need to declare the READ_PHONE_STATE permission in your manifest.
But I am not sure if you can automatically answer calls or if this is even advisable. Answering calls without user consent is a serious privacy breach. You might want to keep that in mind.
精彩评论