> ## Documentation Index
> Fetch the complete documentation index at: https://qualcomm-3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Batching API functions 

Batching API functions are used to start or stop location batching sessions. Invoke the batching APIs after invoking [CapabilitiesCb](https://docs.qualcomm.com/doc/80-80023-25/topic/CapabilitiesCb.html#capabilities-cb), which is registered with the `LocationClient` constructor.

## **startRoutineBatchingSession**

Starts a routine mode batching session with specified parameters.

* If this API is called when idle, or after any other previous position/batching/geofence session is stopped, it delivers one of the following results:
  * If `batchingCallback` is `nullptr`, this call is a no-op.
  * If both `minInterval` and `tripDistance` do not take effect, this call is a no-op. Otherwise a batching session is started with the specified parameters and callbacks.
* If this API is called when any previous position/batching/geofence session hasn’t yet received `responseCallback`, then this API receives an error code of `LOCATION_RESPONSE_REQUEST_ALREADY_IN_PROGRESS` via its `responseCallback`.
* If this API is called during an ongoing session after the `responseCallback` has been received for the ongoing session, the parameters/callback will be updated, and the session continues but with a new set of parameters/callback.
* Locations are reported on the `batchingCallback` in batches when the batch is full.

**Syntax**

```text theme={null}
bool startRoutineBatchingSession(uint32_t minInterval, uint32_t minDistance,
BatchingCb batchingCallback, ResponseCb responseCallback);
```

**Parameters**

|    **Parameter**   |                                                                                                                                                                                                                                                                                                                                                                                                             **Description**                                                                                                                                                                                                                                                                                                                                                                                                             |
| :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|    `minInterval`   | Time between fixes (TBF) in milliseconds (ms). The actual interval of reports received isn’t larger than milliseconds. This value is rounded up by the next interval granularity supported by the underlying system. <ul><li>0 to indicate that the parameter does not take effect.</li><li>The underlying system may have a minimum interval threshold (for example, 100 ms or 1000 ms). Effective intervals aren’t smaller than this lower bound.</li><li>The effective intervals may have a granularity level higher than 1 ms, for example, 100 ms or 1000 ms. So milliseconds being 1559 may be honored at 1600 ms or 2000 ms, depending on the system.</li><li>Where there is another application in the system having a session with a shorter interval, this client may benefit and receive reports at that interval.</li></ul> |
|    `minDistance`   |                                                                                                                                                                                                                                                                   Specifies the minimum distance, in meters, that should be traversed before a position should be batched. If 0, the positions are batched after the `minInterval` period expires. Note By default, this parameter is always set to 0 for this release. Do not set this parameter to a nonzero value.                                                                                                                                                                                                                                                                   |
| `batchingCallback` |                                                                                                                                                                                                                                                                                                                                                                                            Callback to receive batching positions and status.                                                                                                                                                                                                                                                                                                                                                                                           |
| `responseCallback` |                                                                                                                                                                                                                                                                                                                                                                                             (Optional) Callback to receive system responses.                                                                                                                                                                                                                                                                                                                                                                                            |

**Response**

Returns `true` if a batching session is successfully started.

Returns `false` if a batching session isn’t started, that is, when `batchingCallback` is `nullptr`.

## **stopBatchingSession**

Stops the ongoing batching session and deregisters the callbacks of a previous batching session. No callback is issued regarding the processing status.

**Syntax**

```text theme={null}
void stopBatchingSession();
```

**Parameters**

None

**Response**

None
