Android English document translation series (1)--alarmmanager

Source: Internet
Author: User

Original: Individual translation, the level is limited, welcome crossing correct. Public Classalarmmanagerextends Object
Java.lang.Object
? Android.app.AlarmManager
Class Overview

This class provides access to the system alarm services.

This class can provide access to the system alarm service,

These allow you to schedule your application to being run at some point in the future.

He allows you to schedule your app to run at some point in the future.

When a alarm goes off, the that's Intent had been registered for it's broadcast by the system,

When the alarm clock is up, register into the system broadcast intent,

Automatically starting the target application if it is not already running.

The target program will run automatically if the program has not yet started.

Registered alarms was retained while the device was asleep (and can optionally wake the device up if they go off during tha T time), but would be cleared if it was turned off and rebooted.

The Alarm Manager holds a CPU wake lock as long as the Alarm receiver ' s OnReceive () method is executing.

This guarantees, that the phone won't sleep until you have finished handling the broadcast.

Once onreceive () returns, the Alarm Manager releases this wake lock.

This means, that the phone would in some cases sleep as soon as your OnReceive () method completes.

If your alarm receiver called Context.startService() , it is possible that the phone would sleep before the requested service is launched.

To prevent this, your broadcastreceiver and Service would need to implement a separate wake lock policy to ensure the Phone continues running until the service becomes available.

Note:the Alarm Manager is intended for cases where you want to has your application code run at a specific time,even If your application is not currently running.

Description

For normal timing operations (ticks, timeouts, etc) it's easier and much more efficient-use Handler .

For most timed operations (reminders, timeouts, etc.) the application of handler will be simpler and more efficient.

Instantiate this class directly; Instead, retrieve it through Context.getSystemService(Context.ALARM_SERVICE) .

You don't need to instantiate its object, just get it through Context.getsystemservice (Context.alarm_service).

English too food, consciousness is still very vague, need to strengthen English ah, a lot of reading English documents.

                                                                                                      ,         &NB Sp                         When the device is in hibernation, the registered alarm will be retained (if the time is up, the device will wake up), but The alarm clock is off                                                                        Or if the alarm is restarted, the previous settings will be cleared.                                                                                       alarm manager  will maintain the CPU activation state to the receiver of the alarm broadcast onreceive ()   method run.                                                                        This will ensure that the phone does not hibernate unless you end the processing of broadcast events.                                                                                        onreceive () returns once, Alarm manager releases the wake-up lock.                                                                       This means your phone is in some case a slumber, your  onreceive () The   method will end,                                                                       if the receiver of the alarm broadcast, calls the   Context.startservice () , your phone will probably run before the requested service runs                                                                         will sleep dead.                                                                       to prevent this from happening, your broadcast receivers and services need to implement a separate device wake-up mechanism, Make sure your phone can be                                                                           continues to run unless the service is already in effect.                                                                                  Alarm Manageris to apply in this case when you need to get your program to execute at a certain time, even when your program is not running.

Android English document translation series (1)--alarmmanager

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.