wood burning stoves 2.0*
The moose likes Android and the fly likes How to subscribe to events in Android Phone? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to subscribe to events in Android Phone?" Watch "How to subscribe to events in Android Phone?" New topic
Author

How to subscribe to events in Android Phone?

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Hi,

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.

SCJP2, SCWCD
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
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".


Ping & DNS - my free Android networking tools app
 
jQuery in Action, 2nd edition
 
subject: How to subscribe to events in Android Phone?