class CumulocityConnectionFactory : ConnectionFactory<User>
Establish your connection instances to Cumulocity through this class.
e.g.
CumulocityConnectionFactory.connection(<tenant>, <instance e.g. cumulocity.com>).connect(<user>, <password>) { connection, responseInfo ->
if (conn.isConnected) {
Log.i("success", "Hello ${conn.userProfile().firstName}, ${conn.userProfile().lastName}")
ManagedObjectService(connection).get("12345") { result ->
if (status == 500) {
val failureReason: String? = results.reason
...
} else {
val device: ManagedObject = results.content
...
}
}
} else {
Log.e("error", "Login Refused - ${conn.failureReason}")
}
}
The connection can be reused without having to re-authenticate if required.
interface CumulocityConnection : Connection<User>
Represents a connection. Call the connect() method to test and/or retrieve the User profile of the cumulocity account associated with given credentials. The implementation of this interface is returned via the CumulocityConnectionFactory connection method. |
CumulocityConnectionFactory()
Establish your connection instances to Cumulocity through this class. |
fun connection(tenant: String, serverInstance: String): CumulocityConnectionFactory.CumulocityConnection
Returns a connection object for the given tenant and instance |