# Start Service

Service is a Global Action Set that you can run as a background process.

Action available for the following operating systems:

![](https://3821468174-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LrTlA1suFa5N48x_83N%2F-MGIW3wIXgRupIGNu8-p%2F-MGIiDGuNcrVFP-DbUma%2FTodos.PNG?alt=media\&token=406123c5-e2bb-4ec6-8044-9533b8686f6f)

### Parameters

* **Service** *\<numeric> -* Select a number for a service. Can be Dynamic or 1-10.
* **Global Action Set** - Select a Global Action Set to run as a Service.
* **Start Type** *\<numeric> -* Select how do you want to Start the Service:
  * 1 - *Immediate* - The ActionSet will start to execute immediatly.&#x20;
  * 2 - *With Delay* - The ActionSet will start to execute after the specified delay time.&#x20;
  * 3 - *Periodic* - Similar to a Timer, the ActionSet will execute with the specified interval.
* &#x20;**Cancel execution if running** *\<numeric>*
  * 1 - Yes (Used to cancel a service if it is running while reactivating the service with a call to this action)&#x20;
  * 2 - No
* &#x20;**Delay (ms)** *\<numeric> -* Specified the delay or interval depending on the **Start Type**.

{% hint style="info" %}
In Win32 (includes Windows CE an Mobile) services are not supported. Calling this, will cause a service to be emulated by the current process, by running the ActionSet in a background thread. But if the project closes, the services will also stop working.
{% endhint %}

{% hint style="warning" %}
Services require Android 5.0 or later.
{% endhint %}

{% hint style="info" %}

* It is important to be aware that service executions have high limitations imposed differently by the different O.S.
* Periodic services are not ment to be executed with high frequency, they are ment to be executed for example every 1 or 2 hours.
* On Win10, the Periodic service delay cannot be lower than 15 min, and the service code will have a time limit of about 30 seconds to run.
* On iOS, only immediate services are available, and it will have a time limit of around 3 minutes after the app is suspended. It can be useful if you have some code that you want to get executed even if the user exits your App.
* On Android, the system will start to delay the Periodic timer, specially if you specified a high frequency.
* On Android you can increase the service priority and ensure it will not be likely to get suspended by using Android Foreground Services. Check **SetServiceNotification** action for more information.
  {% endhint %}

{% hint style="danger" %}
VERY IMPORTANT: Do not use **User Interface** code in services. Do not open Forms, Show Message Boxes, Popups, etc. If you do, the behavior is undetermined and can cause the application to crash.
{% endhint %}

{% hint style="info" %}
Services are supposed to execute tasks in the Background. If you need to inform the application of something, you can use **PostAppNotification** action. Database and global variables are shared with the service also.
{% endhint %}
