-1

I need programming help to answer the calls in android.

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
Waseem
  • 291
  • 1
  • 6
  • 20
  • 10
    If you expect people to invest their time answering your question, YOU should invest some time in asking the question. – Mitch Wheat Aug 11 '10 at 14:09
  • i am asking because i need help in my project. – Waseem Aug 11 '10 at 14:13
  • 2
    What Mr. Wheat presumably means is that your question is too short and too vague. Please consider adding 100-200 words explaining what you think it means to "answer the calls in android". Most likely, what you want to do is not possible from an Android SDK application, but without more details, we cannot offer you alternative solutions. – CommonsWare Aug 11 '10 at 14:35

1 Answers1

2

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.

codinguser
  • 5,562
  • 2
  • 33
  • 40