Alexander Stolte Expert Licensed User Longtime User Dec 22, 2023 #1 Hello, I come from the following thread: Start receiver at exact time The standard StartReceiverAt is inexact, in order to allow the OS to make optimizations. Worth reading: https://developer.android.com/training/scheduling/alarms Exact scheduling: 1. AddPermission(android.permission.SCHEDULE_EXACT_ALARM) 2. Private ion As Object - class global 3. Private... www.b4x.com "Worth reading: https://developer.android.com/training/scheduling/alarms" I took Erel's words to heart and read through the article and found the following: Schedule alarms | Background work | Android Developers Learn how to use Android's AlarmManager to schedule time-based operations that can run even when your application is not active, distinguishing between inexact and exact alarms and their implications for system resources. developer.android.com From the article: "Repeating alarms allow the system to notify your app on a recurring schedule. A poorly-designed alarm can cause battery drain and put a significant load on servers. For this reason, on Android 4.4 (API level 19) and higher, all repeating alarms are inexact alarms. A repeating alarm has the following characteristics: An alarm type. For more discussion, see Choose an alarm type. A trigger time. If the trigger time you specify is in the past, the alarm triggers immediately. The alarm's interval. For example, once a day, every hour, or every 5 minutes. A pending intent that fires when the alarm is triggered. When you set a second alarm that uses the same pending intent, it replaces the original alarm." How can I implement the whole thing in B4A with receivers, to start a receiver every day at 10 o clock?
Hello, I come from the following thread: Start receiver at exact time The standard StartReceiverAt is inexact, in order to allow the OS to make optimizations. Worth reading: https://developer.android.com/training/scheduling/alarms Exact scheduling: 1. AddPermission(android.permission.SCHEDULE_EXACT_ALARM) 2. Private ion As Object - class global 3. Private... www.b4x.com "Worth reading: https://developer.android.com/training/scheduling/alarms" I took Erel's words to heart and read through the article and found the following: Schedule alarms | Background work | Android Developers Learn how to use Android's AlarmManager to schedule time-based operations that can run even when your application is not active, distinguishing between inexact and exact alarms and their implications for system resources. developer.android.com From the article: "Repeating alarms allow the system to notify your app on a recurring schedule. A poorly-designed alarm can cause battery drain and put a significant load on servers. For this reason, on Android 4.4 (API level 19) and higher, all repeating alarms are inexact alarms. A repeating alarm has the following characteristics: An alarm type. For more discussion, see Choose an alarm type. A trigger time. If the trigger time you specify is in the past, the alarm triggers immediately. The alarm's interval. For example, once a day, every hour, or every 5 minutes. A pending intent that fires when the alarm is triggered. When you set a second alarm that uses the same pending intent, it replaces the original alarm." How can I implement the whole thing in B4A with receivers, to start a receiver every day at 10 o clock?
asales Expert Licensed User Longtime User Dec 23, 2023 #2 Here is my example using services. It works fine in my apps, but with some issues, as I said in this post. And will be changed in Android 14: Schedule exact alarms are denied by default | Android Developers This document outlines the changes to the SCHEDULE_EXACT_ALARM permission in Android 14, where it is no longer pre-granted to most newly installed apps, and discusses migration steps, best practices, and alternative APIs. developer.android.com You can change to receiver using this code. Start receiver at exact time The standard StartReceiverAt is inexact, in order to allow the OS to make optimizations. Worth reading: https://developer.android.com/training/scheduling/alarms Exact scheduling: 1. AddPermission(android.permission.SCHEDULE_EXACT_ALARM) 2. Private ion As Object - class global 3. Private... www.b4x.com Attachments schedulingtest.zip schedulingtest.zip 10.4 KB · Views: 553 Upvote 0
Here is my example using services. It works fine in my apps, but with some issues, as I said in this post. And will be changed in Android 14: Schedule exact alarms are denied by default | Android Developers This document outlines the changes to the SCHEDULE_EXACT_ALARM permission in Android 14, where it is no longer pre-granted to most newly installed apps, and discusses migration steps, best practices, and alternative APIs. developer.android.com You can change to receiver using this code. Start receiver at exact time The standard StartReceiverAt is inexact, in order to allow the OS to make optimizations. Worth reading: https://developer.android.com/training/scheduling/alarms Exact scheduling: 1. AddPermission(android.permission.SCHEDULE_EXACT_ALARM) 2. Private ion As Object - class global 3. Private... www.b4x.com