Joke Collection Website - Public benefit messages - How to judge the status of Android after sending multiple short messages?
How to judge the status of Android after sending multiple short messages?
List & lt string & gt contents = SMS manager. Divide message (content); //multiple text messages. Here, the short message with long content is divided into multiple short messages to send.
For (string text: content) (
SMS manager . sendtextmessage(destination address,scAddress,text,sentIntent,delivery intent); //Send SMS
}
When you send a text message, there are two results. One is whether the message was sent successfully, and the other is whether the other party received it successfully. Whether the SMS is sent successfully is not determined by the Android program. Short messages are sent by short message base stations, such as mobile. We only need to send short messages to the mobile wireless communication network. If the network sends SMS successfully, the mobile phone will return a signal, which will be captured by the program.
The program captures the signal asynchronously, because it is impossible to keep the thread open and wait for the returned signal, so the last two parameters of sendTextMessage (), sentIntent and deliveryIntent, are used to accept the sending and receiving status signals.
SentIntent is the intention of whether the short message is sent successfully or not; DeliveryIntent is the intention of the receiver to receive the short message. If you don't want to receive the returned signal, you can set it to null.
After sending the intention, if the mobile network returns the signal of success or failure in sending the short message, the operating system will broadcast the intention asynchronously, and you will know the status of the short message.
- Related articles
- Xiaomi's mobile phone can't find the input method for sending short messages.
- Tips for cooling down (tips for cooling down in small classes)
- How does Apple set the WeChat floating window?
- Mobile phone automatically blocks short messages of 10086.
- How about Liuzhou Huxi Experimental Middle School?
- The most beautiful good morning wishes
- How to close the stage of sinus existence?
- 2022 New Year Message (Warm Edition)
- Is the Mid-Autumn Festival car restricted?
- Clean SMS for Spring Festival education