SDK Installation

Follow the guide to set-up Xamarin SDK integration

Steps To Add Dapi To Your Project

1. Get Your API Key AppKey

2. Set up Backend Server

  • Important! Using the SDK requires configuring a backend server. Read more about the flow and requirements: Server set-up for SDKs. For development purposes, the server can be easily set up on your local machine.

  • Once the server runs successfully, make sure to add the host URL as App Server URL on the Dapi Dashboard

Now the SDK will automatically know where to send its requests!

1740

3. Add Project Bundle ID to Dashboard

For Android:

  1. Open your Android application settings
  2. Copy the value of Package name
1494
  1. Open your app in the Dashboard.
  2. Select your Application → Go to App Settings
  3. Click on the Bundle IDs + icon, paste the Bundle ID value, and click Submit
1852

For iOS:

  1. Open your info.plist file
  2. Copy the value of Bundle Identifier
1110
  1. Add it to the dashboard too If it is different from your Android Package name

Install Dapi Xamarin SDK

You will be installing the SDK as 3 components, in your main App, App.iOS, and App.Android projects. All the 3 components are available on NuGet.

The first step is to open your solution in Visual Studio.

App

  1. In Visual Studio, from the project navigator, right-click on your App project > Add > NuGet Package.
  2. Search for DapiConnect.
  3. Click Add Package.

App.Android

  1. In Visual Studio, from the project navigator, right click on your App.Android project > Add > NuGet Package.
  2. Search for DapiConnect.Droid.
  3. Click Add Package.
  4. In MainActivity.cs, add Xamarin.Forms.DependencyService.Register<IDapiPlatformService, DapiPlatformService>(); just before LoadApplication(new App());.

Note: Visual Studio should auto import the following (if not, add them manually):

using DapiConnect;
using DapiConnect.Droid;

App.iOS

  1. In Visual Studio, from the project navigator, right click on your App.iOS project > Add > NuGet Package.
  2. Search for DapiConnect.iOS.
  3. Click Add Package.
  4. In AppDelegate.cs, add Xamarin.Forms.DependencyService.Register<IDapiPlatformService, DapiPlatformService>(); just before LoadApplication(new App());.

Note: Visual Studio should auto import the following (if not, add them manually):

using DapiConnect;
using DapiConnect.iOS;

Usage

  1. Import Dapi
using DapiConnect;
  1. Start the SDK
await client.StartDapi("#app_key#", "#client_user_id#");
  • Replace app_key with your appKey from the first step.

  • ClientUserID is used to distinguish between different end-users. The value for clientUserID needs to be set by you. We recommend setting clientUserID to your actual user ID that you use to distinguish between users.

Example

Clone this repository, run the application and see Dapi in action.


What’s Next