StartServiceAt (Service As Object, Time As Long, DuringSleep As Boolean)Schedules the given service to start at the given time.
Service - The service module. Pass Me when calling from a service module that schedules itself.
Time - The time to start the service. If this time has already past the service will be started now.
The actual delivery time might change to reduce battery usage. Use StartServiceAtExact if the exact time is important.
DuringSleep - Whether to start the service when the device is sleeping. If set to false and the device is sleeping
at the specified time, the service will be started when the device wakes up.
Setting DuringSleep to True can have a large impact on the battery usage.
StartServiceAt can be used to schedule a repeating task. You should call it under Service_Start to schedule the next task.
This call cancels previous scheduled tasks (for the same service).
StartServiceAt(SQLService, DateTime.Now + 30 * 1000, false) 'will start after 30 seconds.
B4A Tutorial Background location tracking - Erel    Nov 29, 2018   (39 reactions)   tags: Longrunningaoo, background clock alive, B4A Background location, gps, B4A
https://www.b4x.com/basic4android/images/SS-2018-11-29_15.48.38.png Simple example of a foreground service that keeps the process running in the background. The current location is shown in the persistent notification. The app starts at boot and theoretically should run all the time. It also schedules itself to run with StartServiceAt. This can help in cases where the OS kills the process. Relevant example, based on this example, which plays music in the background: https://www.b4x.com...
B4A Question I issue a StartServiceAt() and in the meanwhile the running App is killed. - tigrot    Nov 20, 2020
I start a StartServiceAt() with a period of 60 minutes. Expecially during the night, the running App is killed and the Service is never started. I was thinking that StartServiceAt() was enough to keep the App running. Have I to keep some service foreground to succede in this job?
Thank you for...
B4A Question Does StartServiceAt need to be in the same service's Service_Start Sub? - JohnC    Mar 23, 2020
be scheduled to run again, and then later do a StartServiceAt() in a sub that is NOT the Service_Start sub - in fact, the StartServiceAt call might be in a different service all together.
So, is there some reason a StartServiceAt should be in the Start_Activity - for example would it increase...
B4A Question B4A v8.00 StartServiceAt / StartServiceAtExact / SetExactAndAllowWhileIdle - Pendrush    Mar 19, 2018
Do we still need this code in B4A 8.00+:
Sub SetExactAndAllowWhileIdle (Time As Long, ServiceName As String)
Dim p As Phone
If p.SdkVersion < 23 Then
B4A Tutorial android.jar / targetSdkVersion / minSdkVersion - Erel    Dec 24, 2017   (65 reactions)   tags: runtime permission, sdk version, Targetsdk, SDK, B4A
, StartServiceAt or #StartAtBoot will only work with B4A v8+. - 26 - installation from unknown sources requires...
B4A Tutorial Automatic Foreground Mode - Erel    Mar 12, 2018   (15 reactions)   tags: Mode, service foreground, Automatic Foreground Mode, Automatic, Foreground, Services
This is a new feature added in B4A v8.0. Starting from Android 8.0, services cannot be simply started while the app is in the background or not running at all. Background means that there isn't any visible activity or any service in foreground state (Service.StartForeground). Common cases where we expect services to start even if the app is not in the foreground: - Push notifications - Services scheduled with StartServiceAt or StartServiceAtExact - Services set to start after boot...
B4A Tutorial Creating a sticky service - long running background tasks - Erel    Mar 7, 2013   (12 reactions)   tags: Services
Edit: Things have changed with newer versions of Android and new restrictions. Sticky services should not be used any more. Background service example: https://www.b4x.com/android/forum/threads/background-location-tracking.99873/#content This tutorial is not 100% correct anymore. There are several ways to handle background tasks. 1. You can use StartServiceAt to schedule a service to run at a specific time. When the service is started you can schedule the next one. This way you can create...
B4A Tutorial Service Modules - Erel    Jan 27, 2011   (6 reactions)   tags: Services
(or StartServiceAt). When this subs runs the process is moved to the foreground state. Which means... every couple of minutes / hours you should schedule the next task with StartServiceAt inside... task. By calling StartServiceAt you can schedule your service to run at a specific time. You can call StartServiceAt in Sub Service_Start to schedule the next time and create a repeating task (for...
B4A Question StartServiceAt() quetion - jayshen    Sep 9, 2018
I made a project with B4A_3.82 + JDK_1.7 + API_19 about many years ago.
It runs normally in Android 4.4 devices.
But it runs abnormally in Android 5.0 or above devices.
B4A Tutorial Starter Service - Consistent & Single Entry Point - Erel    Aug 25, 2015   (24 reactions)   tags: Boot
example if you use StartServiceAt and the OS kills the process while it is in the background. Now...
Page: 1   2   3   4   5