Joke Collection Website - Public benefit messages - The difference between suspended content and intention

The difference between suspended content and intention

Intent means intention in English, and pending means something that is about to happen or come.

PendingIntent is a class that deals with what is going to happen. For example, in the notification notification, it is used to jump the page, but not immediately.

Intention begins in time and disappears with the disappearance of its activities.

PendingIntent can be regarded as a wrapper of intention. Instances of pendingintent are usually obtained through getactivity, getbroadcast and getservice. The current activity cannot immediately start the intention it contains, but calls the intention when it is executed externally. Because the context of the current App is stored in the pending content, it gives the external App a capability to execute the intention in the pending content like the current App, even if the current App no longer exists at the time of execution, it can still execute the intention through the context in the pending content. In addition, you can also handle actions that are intended to be executed. Usually used with alermanger and notificationmanager.

Intent is generally used to transfer data between Activity, Sercvice and BroadcastReceiver, while PendingIntent is generally used in Notification, which can be understood as delayed Intent. PendingIntent is a package of intent.

PendingIntent is a description of intention. We can describe this to other programs, and other programs will do what you arrange to do at another time in the future according to this description (by giving another application a pending intention, you are granted the right to perform the operation you specify, just as if that application is yourself, which is equivalent to pending intention. In this example, other programs are programs that send short messages. After the short message is sent successfully, the intention should be broadcast.

Description of parameters in SMS manager function. Send a text message (string destination address, string sc address, string text, pending intent to send, pending intent to deliver):

1) Pending Intent send Intent: When sending a short message, if it is successful, SendIntent will broadcast its internal description intention; Otherwise, an error code will be generated and a callback will be made through android.app.Pending Intent When finished. This parameter is best not to be empty, otherwise there will be a potential problem of resource waste;

2)pending content delivery intent: It is a pending intention broadcast after the message has been delivered to the receiver.

Looking at the PendingIntent class, you can see many Send functions, that is, PendingIntent is doing the given related operations.