开发者

How to perform an action in Android when receiving and SMS?

开发者 https://www.devze.com 2023-02-10 17:12 出处:网络
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 n

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号