-
public class DoorstepAI
-
-
Field Summary
Fields Modifier and Type Field Description private BooleandevModeprivate BooleanmanualForegroundprivate DoubleautoStopAfterDropoffSecondspublic final static DoorstepAIINSTANCE
-
Method Summary
Modifier and Type Method Description final Unitinit(Context context, String notificationTitle, String notificationText, Function1<Result<Unit>, Unit> callback)final UnitstartDeliveryByPlaceID(String placeID, String deliveryId, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByPlaceID(String placeID, String deliveryId, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByPlusCode(String plusCode, String deliveryId, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByPlusCode(String plusCode, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressString(String address, String deliveryId, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressString(String address, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressString(String address, String deliveryId, LatLngObject coordinates, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByLatLng(Double latitude, Double longitude, String deliveryId, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByLatLng(Double latitude, Double longitude, String subUnit, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressType(AddressType address, String deliveryId, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressType(AddressType address, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)final UnitstartDeliveryByAddressType(AddressType address, String deliveryId, LatLngObject coordinates, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)final UnitnewEvent(String eventName, String deliveryId, Function1<Result<String>, Unit> callback)final UnitnewEvent(String eventName, String deliveryId)final UnitmarkDropoff(String deliveryId, DropoffType dropoffType)final UnitstopDelivery(String deliveryId)final UnitsetAPIKey(String key)final BooleanenableDevMode()Securely enables dev mode after validating the API token. final BooleanvalidateDevModeAccess()Validates whether the current API key has dev mode privileges without changing devMode state. final BooleanwaitForCachedDataCompletion()Waits for all cached data to be processed by the automatic FlushWorker AND for all network requests to complete. final BooleanhasCachedData()Check if there are any cached requests waiting to be submitted. final BooleanisCacheProcessingInProgress()Check if cached data is currently being processed. final BooleanhasPendingNetworkRequests()Check if there are pending network requests that haven't completed yet. final IntegergetPendingNetworkRequestsCount()Get the count of pending network requests. final UnitdisableDevMode()Disables dev mode safely. final BooleangetDevMode()final UnitsetDevMode(Boolean devMode)final BooleangetManualForeground()When true, the SDK will NOT promote its internal TrackingService to the foreground. final UnitsetManualForeground(Boolean manualForeground)final DoublegetAutoStopAfterDropoffSeconds()Host-app override for the post-dropoff auto-stop timer, in seconds. final UnitsetAutoStopAfterDropoffSeconds(Double autoStopAfterDropoffSeconds)-
-
Method Detail
-
init
final Unit init(Context context, String notificationTitle, String notificationText, Function1<Result<Unit>, Unit> callback)
-
startDeliveryByPlaceID
final Unit startDeliveryByPlaceID(String placeID, String deliveryId, Function1<Result<String>, Unit> callback)
-
startDeliveryByPlaceID
final Unit startDeliveryByPlaceID(String placeID, String deliveryId, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByPlusCode
@Deprecated(message = Use startDeliveryByAddressString(address, deliveryId, coordinates, timeoutSeconds, callback) instead.) final Unit startDeliveryByPlusCode(String plusCode, String deliveryId, Function1<Result<String>, Unit> callback)
-
startDeliveryByPlusCode
@Deprecated(message = Use startDeliveryByAddressString(address, deliveryId, coordinates, timeoutSeconds, callback) instead.) final Unit startDeliveryByPlusCode(String plusCode, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressString
final Unit startDeliveryByAddressString(String address, String deliveryId, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressString
final Unit startDeliveryByAddressString(String address, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressString
final Unit startDeliveryByAddressString(String address, String deliveryId, LatLngObject coordinates, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByLatLng
@Deprecated(message = Use startDeliveryByAddressType(...) or startDeliveryByAddressString(...) with coordinates instead.) final Unit startDeliveryByLatLng(Double latitude, Double longitude, String deliveryId, Function1<Result<String>, Unit> callback)
-
startDeliveryByLatLng
@Deprecated(message = Use startDeliveryByAddressType(...) or startDeliveryByAddressString(...) with coordinates instead.) final Unit startDeliveryByLatLng(Double latitude, Double longitude, String subUnit, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressType
final Unit startDeliveryByAddressType(AddressType address, String deliveryId, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressType
final Unit startDeliveryByAddressType(AddressType address, String deliveryId, Double timeoutSeconds, Function1<Result<String>, Unit> callback)
-
startDeliveryByAddressType
final Unit startDeliveryByAddressType(AddressType address, String deliveryId, LatLngObject coordinates, Double timeoutSeconds, Boolean manualForeground, Double autoStopAfterDropoffSeconds, Function1<Result<String>, Unit> callback)
-
newEvent
final Unit newEvent(String eventName, String deliveryId, Function1<Result<String>, Unit> callback)
-
markDropoff
final Unit markDropoff(String deliveryId, DropoffType dropoffType)
-
stopDelivery
final Unit stopDelivery(String deliveryId)
-
enableDevMode
final Boolean enableDevMode()
Securely enables dev mode after validating the API token. This function checks if the current API key has dev mode privileges before enabling it.
-
validateDevModeAccess
final Boolean validateDevModeAccess()
Validates whether the current API key has dev mode privileges without changing devMode state.
-
waitForCachedDataCompletion
final Boolean waitForCachedDataCompletion()
Waits for all cached data to be processed by the automatic FlushWorker AND for all network requests to complete. This function does NOT trigger flushing - it only monitors the automatic background processing. The FlushWorker already runs on a timer and processes cached requests automatically.
-
hasCachedData
final Boolean hasCachedData()
Check if there are any cached requests waiting to be submitted.
-
isCacheProcessingInProgress
final Boolean isCacheProcessingInProgress()
Check if cached data is currently being processed.
-
hasPendingNetworkRequests
final Boolean hasPendingNetworkRequests()
Check if there are pending network requests that haven't completed yet. This is crucial for preventing premature service shutdown when network is slow.
-
getPendingNetworkRequestsCount
final Integer getPendingNetworkRequestsCount()
Get the count of pending network requests.
-
disableDevMode
final Unit disableDevMode()
Disables dev mode safely. This is the only way to disable dev mode since devMode has a private setter.
-
getDevMode
final Boolean getDevMode()
-
setDevMode
final Unit setDevMode(Boolean devMode)
-
getManualForeground
final Boolean getManualForeground()
When true, the SDK will NOT promote its internal TrackingService to the foreground. It expects the host app to already be running a foreground service that keeps the process alive for background tracking. Exposed read-only to the host app; set per-delivery via the
startDeliveryByX(...)functions and persisted to SharedPreferences so TrackingService can read it after process recreation.
-
setManualForeground
final Unit setManualForeground(Boolean manualForeground)
-
getAutoStopAfterDropoffSeconds
final Double getAutoStopAfterDropoffSeconds()
Host-app override for the post-dropoff auto-stop timer, in seconds.
If
null(default), the SDK falls back to the value in remote config (com.doorstepai.sdks.tracking.internal.MiscConfiguration.autoStopAfterDropoffSeconds).If non-null, this value ALWAYS wins over remote config.
If the resolved value is
nullor <= 0, no auto-stop is scheduled.
When scheduled, the timer is backed by android.app.AlarmManager with
setAndAllowWhileIdle, so it is Doze-safe and reliable for long values (10 minutes up to several hours). It does NOT require theSCHEDULE_EXACT_ALARMpermission.Exposed read-only to the host app; set per-delivery via the
startDeliveryByX(...)functions.
-
setAutoStopAfterDropoffSeconds
final Unit setAutoStopAfterDropoffSeconds(Double autoStopAfterDropoffSeconds)
-
-
-
-