How to perform an action in Android when receiving and SMS?
Can someone please help me figure out how to perform an action when sms is received, is there a special method for it? Will it automatically be ran in the background? The only thing I know is that I need to use perm开发者_开发知识库ission RECEIVE_SMS.
You will need to use a BroadcastReceiver
and an IntentFilter
. Check them out in the SDK reference.
If you register an IntentFilter
in the AndroidManifest.xml
with your registration of the BroadcastReceiver
then it will be picked by your BroadcastReceiver
in the background. Look at Intent
and the actions provided.
精彩评论