androidsecurityandroid-2.2-froyo

How to run a program before answer a call in android?


I want to write a program in android will ask for a password when an incoming call is detected. The program will only allow the call to be answered if the password is correct.

How should I implement that?

For example, I found a program that does this: App Lock

...but I have no idea where I should start. Should I write a service?

Thanks and regards.


Solution

  • This may help you: https://web.archive.org/web/20210127130519/http://www.tutorialforandroid.com/2009/01/get-phone-state-when-someone-is-calling_22.html

    You have to register a broadcast receiver in order to catch the events (call ringing, etc, etc..) and based on the various states, you can perform any operations you may want.

    Also check this link: How to block calls in android