This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am new to Android and exploring its API. I want to know how can I subscribe to events in Android phone, for example, when there is a phone call and we press Accept or Decline. How can I subscribe to such event, what do I need to learn for it. Or let us say user sends a SMS, how do I subscribe to such events.
That's the realm of android.content.BroadcastReceivers. For incoming SMS, specifically, you'd handle "android.provider.Telephony.SMS_RECEIVED" intents; for incoming calls it'd be "android.intent.action.PHONE_STATE". Note that the app also needs to have the corresponding permissions, like "android.permission.READ_PHONE_STATE" and "android.permission.RECEIVE_SMS".