For Android Notification click, the program resumes the last operation page (similar to Android QQ ). Home Key

Source: Internet
Author: User

 

As an Android player, to hide and display programs, use Notification to implement switching.

 

The Notification code is as follows:

 

String notificationMessage = (Audio) obj). name_label;

Notification notification = new Notification (R. drawable. icon, icationicationmessage, System. currentTimeMillis ());

Try {

Intent contentIntent = new Intent (getApplicationContext (),

Class. forName ("com. ***. ***. * *** "); // load the class. If the class name is directly passed, the page will be reloaded upon clicking, and the final page status cannot be restored.

ContentIntent. setFlags (Intent. FLAG_ACTIVITY_SINGLE_TOP );

PendingIntent pendingIntent = PendingIntent. getActivity (getApplicationContext (), 0, contentIntent, 0 );

Notification. setLatestEventInfo (PlayerService. this, getString (R. string. app_name), icationicationmessage, pendingIntent );

Notification. flags | = Notification. FLAG_ONGOING_EVENT;

Micationicationmanager. Y (id, notification );

 

} Catch (ClassNotFoundException ex ){

 

// Log

}

 

The author is idle in playing chess

Related Article

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.