简体   繁体   中英

How do i find if sms has been sent in android?

I am developing an app that uses an sms sending(via an intent) feature. To make the app more effective I wish to know the send status of the sms too, so as to notify user that sms has indeed been sent. This is because sometimes sms might not be sent because of poor connectivity, low balance,and so on and so forth.I wish to know how this can be done, since most search results suggest querying through sms log, which I do not want my app to do. Thanks

You can see this tutorial SMS/Message delivery and sent confirmation in Android with example

Make sure to add this permission

<uses-permission android:name="android.permission.SEND_SMS" />

in your AndroidManifest.xml file.

You can use the Telephony Content Provider . For the text message you have just sent, you can check its type. If it is MESSAGE_TYPE_FAILED, then you know the message has not been sent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM