> For the complete documentation index, see [llms.txt](https://robertos-organization-13.gitbook.io/geoflowlive/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robertos-organization-13.gitbook.io/geoflowlive/basics/editor/interactive-blocks.md).

# Custom Actions

Main core actions

**GeoFlowLive's** custom actions offer you fine-grained control over location services within your **FlutterFlow** applications. These actions are designed to be easily integrated into your workflows, providing functionalities such as checking and requesting location permissions, starting and stopping location updates, and calculating distances between coordinates.

📱  Android and iOS support.

🌐  Web support.

&#x20;Explore the available actions below to unlock the full potential of location-awareness in your projects:

### **`geoFlowLiveBearingBetween`**&#xD83D;🌐

Calculates the bearing (azimuth) between two geographical coordinates (start and end). The bearing is the angle in degrees, relative to true north, from the starting point to the ending point.

**Parameters:**

| **Parameter** | **Data Type** | **Description**                                     |
| ------------- | ------------- | --------------------------------------------------- |
| start         | LatLng        | The geographical coordinates of the starting point. |
| end           | LatLng        | The geographical coordinates of the ending point.   |

**Return Value:**

* Data Type: Double (nullable)
* Description: The bearing in degrees, ranging from 0 to 360. Returns null if an error occurs during the calculation.

### **`geoFlowLiveCalculateDistance`**&#xD83D;🌐

Calculates the distance in meters between two geographical coordinates (start and end).

**Parameters:**

| **Parameter** | **Data Type** | **Description**                                     |
| ------------- | ------------- | --------------------------------------------------- |
| start         | LatLng        | The geographical coordinates of the starting point. |
| end           | LatLng        | The geographical coordinates of the ending point.   |

**Return Value:**

* Data Type: Double (nullable)
* Description: The distance in meters between the two points. Returns null if an error occurs during the calculation.

### **`geoFlowLiveCheckLocationPermission`**&#xD83D;🌐

Checks the current location permission status for the application.

* **Parameters:** None
* **Return Value:**
  * Data Type: GeoFlowLivePermission
  * Description: The current location permission status. Possible values are defined in the GeoFlowLivePermission enum (always, while\_in\_use, denied, denied\_forever, unable\_to\_determine).

### **`geoFlowLiveCurrentPosition`**&#xD83D;🌐

&#x20;Retrieves the current location of the device.

* **Parameters:** None
* **Return Value:**
  * Data Type: GeoFlowLivePositionStruct (nullable)
  * Description: A GeoFlowLivePositionStruct containing the current location information (latitude, longitude, altitude, accuracy, etc.). Returns null if an error occurs or if the location cannot be determined.

### **`geoFlowLiveIsLocationServiceEnabled`**&#xD83D;🌐

Checks if location services are enabled on the device.

* **Parameters:** None
* **Return Value:**
  * Data Type: Boolean
  * Description: true if location services are enabled; false otherwise.

### **`geoFlowLiveLastKnownPosition`**&#xD83D;🌐

Retrieves the last known location of the device. This may be a cached location and might not be the most up-to-date position.

* **Parameters:** None
* **Return Value:**
  * Data Type: GeoFlowLivePositionStruct (nullable)
  * Description: A GeoFlowLivePositionStruct containing the last known location information. Returns null if no last known location is available.

### **`geoFlowLiveOpenAppSettings`**&#xD83D;

Opens the application settings page on the device, allowing the user to modify permissions and other settings.

* **Parameters:** None
* **Return Value:**
  * Data Type: Boolean
  * Description: Returns true if the app settings were opened successfully; false otherwise.

### **`geoFlowLiveOpenLocationSettings`**&#xD83D;

Opens the location settings page on the device, allowing the user to enable or disable location services.

* **Parameters:** None
* **Return Value:**
  * Data Type: Boolean
  * Description: Returns true if the location settings were opened successfully; false otherwise.

### **`geoFlowLiveRequestLocationPermission`**&#xD83D;🌐

Requests location permission from the user.

* **Parameters:** None
* **Return Value:**
  * Data Type: GeoFlowLivePermission
  * Description: The resulting location permission status after the user has responded to the permission request. Possible values are defined in the GeoFlowLivePermission enum (always, while\_in\_use, denied, denied\_forever, unable\_to\_determine).

### **`geoFlowLiveStartListeningLocationServiceStatus`**&#xD83D;

Starts listening for changes in the location service status (enabled/disabled). **Important:** This action requires a callback function to handle status updates.

* **Parameters:**

  | Parameter      | Data Type                                         | Description                                                                                                                                                                                                     |
  | -------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | onStatusChange | Future Function(GeoFlowLiveLocationServiceStatus) | A callback function that will be invoked whenever the location service status changes. The function receives a **GeoFlowLiveLocationServiceStatus** enum value (enabled or disabled) indicating the new status. |
* **Return Value:**
  * Data Type: Future\<void>
  * Description: This action does not directly return a value. It triggers the provided callback function (onStatusChange) whenever the location service status changes.

### **`geoFlowLiveStartListeningLocationUpdate`**&#xD83D;🌐

Starts listening for location updates from the device. This action initiates real-time monitoring of the device's location. It leverages the power of streams to provide continuous location updates, while intelligently managing resources to minimize battery consumption and ensure optimal device performance. This hides the complexity of the **Geolocator** package stream implementation.

**Important:** This action requires callback functions to handle location updates, errors, permission denials, and location service disabled events.

* **Parameters:**

  | Parameter                 | Data Type                                  | Description                                                                                                                                                                 |
  | ------------------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | settings                  | GeoFlowLiveSettingStruct                   | A GeoFlowLiveSettingStruct object containing the configuration settings for location updates (accuracy, distance filter, etc.).                                             |
  | onLocationUpdate          | Future Function(GeoFlowLivePositionStruct) | A callback function that will be invoked whenever a new location update is received. The function receives a GeoFlowLivePositionStruct containing the location information. |
  | onError                   | Future Function(String)                    | A callback function that will be invoked if an error occurs while retrieving location updates. The function receives an error message as a string.                          |
  | onPermissionDenied        | Future Function()                          | A callback function that will be invoked if the user denies location permission.                                                                                            |
  | onLocationServiceDisabled | Future Function()                          | A callback function that will be invoked if location services are disabled on the device.                                                                                   |
* **Return Value:**
  * Data Type: Future\<void>
  * Description: This action does not directly return a value. It triggers the provided callback functions (onLocationUpdate, onError, onPermissionDenied, onLocationServiceDisabled) as location events occur.

### **`geoFlowLiveStop`**&#xD83D;🌐

Stops listening for location updates and location service status changes, releasing resources. It's important to call this action when you no longer need location updates to prevent battery drain.

* **Parameters:** None
* **Return Value:**
  * Data Type: Future\<void>
  * Description: This action does not return a value.

{% hint style="warning" %}
It is **crucial** to call the `geoFlowLiveStop` action when you no longer need location updates or location service status updates. Failing to do so can lead to significant battery drain as the app continues to listen for location events in the background. Furthermore, neglecting to stop listening can potentially result in **memory leaks**, which can negatively impact the performance and stability of your **FlutterFlow** application over time. Always ensure that `geoFlowLiveStop` is called when the location functionality is no longer required, such as when a user navigates away from a location-aware screen or disables location tracking in your app.
{% endhint %}
