Android Apidemos Sample Resolution (27)

Source: Internet
Author: User

App->notification->notifying Service Controller

This example describes how to use notification in a service, and the related classes are Notifyingcontroller and Notifyingservice.

The basic method of using notification in service is the same as the previous example. We haven't introduced the usage of the service for the time being. The basic concept of service is essentially the same as in Windows OS: There is no UI to run in the background. Notification can be said to be the best way to inform users of the service. There is a special introduction to the use of the service, here is not explained.

The Notifyingservice implementation displays a notification every 5 seconds in a minute. Icons are smiley faces, expressionless, crying face:

for (int i = 0; i < 4; ++i) {     
 shownotification (r.drawable.stat_happy,     
 r.string.status_bar_notifications_ Happy_message);     
 if (Mcondition.block (5 * 1000)) break     
 ;
 Shownotification (r.drawable.stat_neutral,     
 r.string.status_bar_notifications_ok_message);
 if (Mcondition.block (5 * 1000)) break
 ;
 Shownotification (R.drawable.stat_sad,     
 r.string.status_bar_notifications_sad_message);     
 if (Mcondition.block (5 * 1000)) break     
 ;     

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.