After clicking on notification, get the information in notification

Source: Internet
Author: User

After clicking on notification, it is often necessary to present the information in the notification on the interface.

At the time of testing, the intent object obtained through getintent in the activity always gets the desired information.

Search on the internet found that if you use the same intent, you need to set the flags parameter to Pendingintent.flag_cancel_current when creating pendingintent, as shown below.

Pendingintent.getactivity (atynotification.this, 0, intent, pendingintent.flag_cancel_current)

If not the same intent,flags parameter is not set to Pendingintent.flag_cancel_current

   New Intent (intent.action_view);   Intent2.setdata (Uri.parse ("tel:10086"));   Notification.setcontentintent (Pendingintent.getactivity (atynotification. This, 0, Intent2, 0));

After clicking on notification, get the information in notification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.