DoorstepAI SDK Documentation

DoorstepAI SDK Documentation

Overview

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.


React Native

1. Initialize DoorstepAI

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;
    
Tip: For API Key setup assistance, please contact DoorstepAI Support.

2. Start and Stop Delivery Tracking

Start Delivery

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);
    

Stop Delivery

Call stopDelivery once the delivery is complete.

DoorstepAI.stopDelivery();
    

iOS

1. Initialize DoorstepAI

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")
    

2. Start and Stop Delivery Tracking

Start Delivery

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)
    

Stop Delivery

Invoke stopDelivery() after the delivery is complete.

DoorstepAI.stopDelivery()
    

Android

1. Initialize DoorstepAI

Set your API key to enable the SDK:

import com.doorstepai.dropoffsdk.DoorstepAI

DoorstepAI.setApiKey("YOUR_API_KEY")
    

2. Start and Stop Delivery Tracking

Start Delivery

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)
    

Stop Delivery

End the delivery tracking by calling stopDelivery().

DoorstepAI.stopDelivery()
    

Flutter

1. Initialize DoorstepAI

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()));
}
    

2. Start and Stop Delivery Tracking

Start Delivery

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);
    

Stop Delivery

Once the delivery is completed, call the stopDelivery() method.

DoorstepAI.stopDelivery();
    

Error Handling and Troubleshooting

Note: Make sure to handle potential errors when setting the API key and starting/stopping delivery tracking. Contact support if you encounter any issues with permissions or tracking.
Need Help? Our support team is here for you. Feel free to reach out with any questions or concerns.