Reset SDK.
Kotlin
initAsleepConfig(
context: Context,
apiKey: String,
userId: String?,
baseUrl: String?,
callbackUrl: String?,
service: String?,
asleepConfigListener: Asleep.AsleepConfigListener
)
Parameter Name Type Description context Context Enter ApplicationContext apiKey String Enter the value issued by Generate API key userId String? Enter null if there is no initial userId, and enter the userId that has been issued since baseUrl String? If null, use the default value, enter the proxy server address callbackUrl String? Enter the url of the server to receive sleep session analysis results service String? your app name asleepConfigListener AsleepConfigListener listener to receive callback for userId
Kotlin
interface AsleepConfigListener {
fun onSuccess(userId: String?, asleepConfig: AsleepConfig?)
fun onFail(errorCode: Int, detail: String)
}
If success, onSuccess()is called.
Parameter Name Type Description userId String? Newly issued or entered userId asleepConfig AsleepConfig? Required set value to use the SDK
If failure, onFail() is called.
Parameter Name Type Description errorCode Int AsleepErrorCode detail String errorCode Message
Delete all data of the user, including userId.
Kotlin
fun deleteUser(deleteUserIdListener: DeleteUserIdListener?)
Parameter Name Type Description deleteUserIdListener DeleteUserIdListener? listener to receive callback for deleted userId
Kotlin
interface DeleteUserIdListener {
fun onSuccess(userId: String?)
fun onFail(errorCode: Int, detail: String)
}
If success, onSuccess()is called.
Parameter Name Type Description userId String? deleted userId
If failure, onFail() is called.
Parameter Name Type Description errorCode Int See AsleepErrorCode detail String errorCode Message