The DoorstepAI SDK provides an effortless integration solution for iOS, Android, Flutter, and React Native applications to handle delivery tracking. With simple API calls, developers can start and stop delivery tracking while ensuring proper permissions are in place.
Place the DoorstepAIRoot
component at the root of your main application view to initialize the SDK with your API key.
// App.js
import React from 'react';
import { DoorstepAIRoot } from "@doorstepai/dropoff-sdk";
const App = () => (
<DoorstepAIRoot apiKey="YOUR_API_KEY">
);
export default App;
Use startDelivery
when the driver initiates the delivery. The SDK accepts multiple formats for the delivery address:
// Example usage with different input types
// Start with Google PlaceID
DoorstepAI.startDeliveryByPlaceID("placeID_here");
// Start with Google PlusCode
DoorstepAI.startDeliveryByPlusCode("plusCode_here");
// Start with Address Components
const address = {
street_number: "123",
route: "Main St",
locality: "City",
administrative_area_level_1: "State",
postal_code: "12345"
};
DoorstepAI.startDeliveryByAddressType(address);
Call stopDelivery
once the delivery is complete.
DoorstepAI.stopDelivery();
Add DoorstepAIRoot
at the root level of your main view controller to activate the SDK. Set your API key for authentication:
import DoorstepDropoffSDK
// Initialization
DoorstepAIRoot()
DoorstepAI.setApiKey("YOUR_API_KEY")
To start a delivery, use one of the following options:
// Start with Google PlaceID
DoorstepAI.startDeliveryByPlaceID(placeID: "placeID_here")
// Start with Google PlusCode
DoorstepAI.startDeliveryByPlusCode(plusCode: "plusCode_here")
// Start with Address Components
let address = AddressType(
streetNumber: "123",
route: "Main St",
locality: "City",
administrativeAreaLevel1: "State",
postalCode: "12345"
)
DoorstepAI.startDeliveryByAddressType(address: address)
Invoke stopDelivery()
after the delivery is complete.
DoorstepAI.stopDelivery()
Set your API key to enable the SDK:
import com.doorstepai.dropoffsdk.DoorstepAI
DoorstepAI.setApiKey("YOUR_API_KEY")
When a delivery begins, use any of the supported address input methods:
// Start with Google PlaceID
DoorstepAI.startDeliveryByPlaceID("placeID_here")
// Start with Google PlusCode
DoorstepAI.startDeliveryByPlusCode("plusCode_here")
// Start with Address Components
val address = AddressType(
streetNumber = "123",
route = "Main St",
locality = "City",
administrativeAreaLevel1 = "State",
postalCode = "12345"
)
DoorstepAI.startDeliveryByAddressType(address)
End the delivery tracking by calling stopDelivery()
.
DoorstepAI.stopDelivery()
To initialize the SDK in Flutter, wrap the main app widget with DoorstepAIRoot
and pass in the API key for authentication.
import 'package:doorstepai_dropoff_sdk/doorstepai_dropoff_sdk.dart';
void main() {
runApp(DoorstepAIRoot(apiKey: "YOUR_API_KEY", child: MyApp()));
}
Use the startDelivery
method to initiate delivery tracking. The SDK supports various address input formats:
// Start delivery with Google PlaceID
DoorstepAI.startDeliveryByPlaceID("placeID_here");
// Start delivery with Google PlusCode
DoorstepAI.startDeliveryByPlusCode("plusCode_here");
// Start delivery with Address Components
AddressType address = AddressType(
streetNumber: "123",
route: "Main St",
locality: "City",
administrativeAreaLevel1: "State",
postalCode: "12345"
);
DoorstepAI.startDeliveryByAddressType(address);
Once the delivery is completed, call the stopDelivery()
method.
DoorstepAI.stopDelivery();