SDK Installation
Follow the guide to set-up Android SDK integration
Steps To Add Dapi To Your Project
1. Get Your API Key AppKey
- To start using Dapi APIs, log in or create an account at Dashboard.
- Follow instructions about getting your 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!
3. Add Project Bundle ID to Dashboard
- Open your .build.gradle file
- Copy the value of applicationId
- Open your app in the Dashboard.
- Select your Application → Go to App Settings
- Click on the Bundle IDs + icon, paste the Bundle ID value, and click Submit
Install Dapi Android SDK
Open Gradle Scripts | build.gradle (Module: app) and do the following:
- Add the following to the dependencies {} section of your build.gradle (module: app) file to compile the latest version of the Connect SDK:
implementation "co.dapi:connect:2.37.5"
-
Save and close build.gradle (Module: app).
-
Build your project.
Usage
- Open your application class file and import Dapi there
import co.dapi.connect.core.base.Dapi
- Start the SDK in onCreate method
Dapi.start(
application = this,
appKey = "<#app_key#>",
clientUserID = "<#client_user_id#>",
onSuccess = {
},
onFailure = { error ->
}
)
Dapi.start(
this,
"<#app_key#>",
"<#client_user_id#>",
() -> {
//Success
return Unit.INSTANCE;
},
(error) -> {
//Error
return Unit.INSTANCE;
}
);
-
Replace
app_key
with your appKey from the first step. -
ClientUserID
is used to distinguish between different end-users. The value forclientUserID
needs to be set by you. We recommend settingclientUserID
to your actual user ID that you use to distinguish between users.
Example
Clone this repository, run the application and see Dapi in action.
Updated 10 months ago