Documentation

Documentation

  • YourOwn Setup
  • Connect Setup
  • YourOwn SDK
  • Connect SDK
  • YourOwn API
  • Connect API
  • Resources
  • Releases

›Getting around

Getting started

  • Copilot Mobile SDK
  • Importing the iOS SDK
  • Importing the Android SDK
  • SDK configuration

Getting around

  • Hello Copilot

Reference

  • Application
  • Authentication
  • User
  • Thing
  • In-app messages
  • Report

Event reporting guide

  • Predefined events
  • Custom events

Appendix

  • Releases
  • Open source mapping

Hello Copilot

The examples below illustrate how to use the main Copilot SDK components.

Chapter 2 is a walkthrough of a single Copilot based flow - how to register an authenticated session for a new user created in Copilot, how to report the analytic events associated with the user, and how to associate a hardware Thing with this User.

💡 Make sure you followed the Importing Copilot SDK for Android and iOS

Authentication - Register user

User registration(signup) is under Auth component, and the auto-completion guides you through the command invocation.

Make sure you call build() and then execute() on the requested command.

⭐ More details about the Auth commands can be found here

iOS
Android
Copilot.instance
.manage
.copilotConnect
.auth
.signup()
.allowCopilotUserAnalysis(true)
.with(email: "ck@dailyplanet.com", password: "Superman1234", firstname: "Clark", lastname: "Kent")
.build()
.execute { [weak self] (response) in
switch response {
case .success:
// User has been successfully registered
case .failure(error: let error):
// Failed to register user, handle error
}
}
Copilot.getInstance()
.Manage
.CopilotConnect
.Auth
.signup()
.withCopilotAnalysisConsent(true)
.withEmailPassword("ck@dailyplanet.com", "Superman1234", "Clark", "Kent")
.build()
.execute(new RequestListener<Void, SignupError>() {
@Override
public void success(Void response) {
// User has been successfully registered
}

@Override
public void error(SignupError error) {
// Failed to register user, handle error
}
});
});

Track application behavior - Report

Reporting every event in your application allows Copilot platform to analyse and engage correctly your users.

⭐ More details about Report component can be found here.

The Copilot SDK already contains a set of predefined analytics events, simplifying the way you report events. Below an example of a signup event, which you should report when receiving a successful response upon registration.

Below you can see an example how to report the Signup succeeded analytics event

iOS
Android
Copilot.instance.report.log(event: SignupAnalyticsEvent())
Copilot.getInstance().Report.logEvent(new SignupAnalyticsEvent());

Once you authenticated

Know your user - FetchMe

When fetching the user, you will receive an instance of UserMe, containing the UserDetails and the AccountStatus.

⭐ More details about User component can be found here.

Below examples for iOS and Android:

iOS
Android
Copilot.instance
.manage
.copilotConnect
.user
.fetchMe()
.build()
.execute { (response) in
switch response {
.success(let userMe):
// fetchMe has been fetched with success
.failure(let error):
// Failed to fetch fetchMe, handle error
}
}
Copilot.getInstance()
.Manage
.CopilotConnect
.User
.fetchMe()
.build()
.execute(new RequestListener<UserMeModel, FetchMeError>() {

@Override
public void success(UserMeModel response) {
// fetchMe has been fetched with success
}

@Override
public void error(FetchMeError error) {
// Failed to fetch fetchMe, handle error
}
});

Know your user’s connected devices - Associate Thing

Once you have registered a user, you can start adding connected devices to their account. You will find associateThing under the Thing API.

⭐ More about the Thing component can be found here.

Below you will find an example of how to add a connected device to your user.

iOS
Android
Copilot.instance
.manage
.copilotConnect
.thing
.associateThing()
.with(physicalID: "PhysicalId", firmware: "Firmware", model: "Model")
.build()
.execute { (response) in
switch response {
case .success(let thing):
// Thing has been associated with success
case .failure(error: let associationError):
// Failed to associate the thing, handle the error
}
}
Copilot.getInstance()
.Manage
.CopilotConnect
.Thing
.associateThing("physicalId", "firmware", "model")
.build()
.execute(new RequestListener<ThingModel, AssociateThingError>() {
@Override
public void success(ThingModel response) {
// Thing has been associated with success
}
@Override
public void error(AssociateThingError error) {
// Failed to associate the thing, handle the error
}
});
← SDK configurationApplication →
  • Authentication - Register user
  • Track application behavior - Report
  • Once you authenticated
    • Know your user - FetchMe
  • Know your user’s connected devices - Associate Thing
Copilot
Mail: hello@copilot.cx
Call: (212).398.0001
© Copilot 2021