Pro Android with Kotlin
Download 5.42 Mb. Pdf ko'rish
|
@de android telegram Pro Android with Kotlin Developing Modern Mobile
- Bu sahifa navigatsiya:
- Table 8-4.
138
CHAPTER 8: APIs You can then issue alarms by various methods, as shown in Table 8-4 . If for API levels 24 or higher you choose to have a listener receive alarm events, the details about how to use the associated handlers are covered in Chapter 10 . If instead you’re aiming at intents, all corresponding methods have a type:Int parameter with the following possible values: AlarmManager.RTC_WAKEUP The time parameter is wall clock time in UTC (milliseconds since January 1, 1970, 00:00:00); the device will be woken up if necessary. AlarmManager.RTC The time parameter is wall clock time in UTC (milliseconds since January 1, 1970, 00:00:00). If the device is asleep, the event will be discarded, and no alarm will be triggered. AlarmManager.ELAPSED_REALTIME_WAKEUP The time parameter is the time in milliseconds since the last boot, including sleep time. The device will be woken up if necessary AlarmManager.ELAPSED_REALTIME The time parameter is the time in milliseconds since the last boot, including the sleep time. If the device is asleep, the event will be discarded, and no alarm will be triggered. Table 8-4. Issuing Alarms Method Description set(type: Int, triggerAtMillis: Long, operation: PendingIntent): Unit This schedules an alarm. An intent gets invoked and triggered according to the type, and the time parameter is provided. Starting with API level 19, alarm event delivery might be inexact to optimize system resources usage. Use one of the setExact methods if you need exact delivery. set(type: Int, triggerAtMillis: Long, tag: String, listener: AlarmManager. OnAlarmListener, targetHandler: Handler): Unit This requires API level 24 or higher. It is a direct callback version of set(Int, Long, PendingIntent). The Handler parameter can be null to invoke the listener on the app’s main looper. Otherwise, the call of the listener will be performed from inside the handler provided. setAlarmClock(info: AlarmManager. AlarmClockInfo, operation: PendingIntent): Unit This requires API level 21 or higher. This schedules an alarm represented by an alarm clock. The alarm clock info object allows for adding an intent, which is able to describe the trigger. The system may choose to display relevant information about this alarm to the user. Other than that, this method is like setExact(Int, Long, PendingIntent) but implies the RTC_WAKEUP trigger type. (continued) |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling