Feat/adapter io (#26) feat:adapt to new io feat:adapt to new io
Feat/adapter io (#26)
feat:adapt to new io
This is the open-source SDK for Aliyunpan-Android OpenAPI.
dependencies { implementation 'com.github.alibaba:aliyunpan-android-sdk:v0.2.3' }
To begin using the sdk, visit our guide that will walk you through the setup process:
Guide
import com.alicloud.databox.opensdk.AliyunpanClient import com.alicloud.databox.opensdk.AliyunpanClientConfig fun initApp(context: Context) { val config = AliyunpanClientConfig.Builder(context, "app_id") .build() // init client val aliyunpanClient = AliyunpanClient.init(config) }
import com.alicloud.databox.opensdk.AliyunpanClient import com.alicloud.databox.opensdk.AliyunpanClientConfig import com.alicloud.databox.opensdk.AliyunpanTokenServer val config = AliyunpanClientConfig.Builder(context, "app_id") .tokenServer(object : AliyunpanTokenServer { // implement some one }) .build() // init client val aliyunpanClient = AliyunpanClient.init(config)
aliyunpanClient.send(AliyunpanUserScope.GetDriveInfo(), { result -> // success }, { // failure })
import com.alicloud.databox.opensdk.kotlin.AliyunpanClient fun initApp(context: Context) { // config val config = AliyunpanClientConfig.Builder(context, "app_id") .build() // init client val aliyunpanClient = AliyunpanClient.init(config) }
lifecycleScope.launch { try { val response = aliyunpanClient.send(AliyunpanUserScope.GetDriveInfo()) } catch (e: Exception) { } }
aliyunpanClient.buildDownload(driveId, fileId, { task -> // success task.addStateChange { taskState -> when (taskState) { BaseTask.TaskState.Abort -> { } is BaseTask.TaskState.Completed -> { } is BaseTask.TaskState.Failed -> { } is BaseTask.TaskState.Running -> { } BaseTask.TaskState.Waiting -> { } } } val startResult = task.start() }, { // failure })
aliyunpanClient.buildUpload(driveId, filePath, { task -> // success task.addStateChange { taskState -> when (taskState) { BaseTask.TaskState.Abort -> { } is BaseTask.TaskState.Completed -> { } is BaseTask.TaskState.Failed -> { } is BaseTask.TaskState.Running -> { } BaseTask.TaskState.Waiting -> { } } } val startResult = task.start() }, { // failure })
Documents
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() maven { url 'https://jitpack.io' } } }
This project is licensed under the MIT License - see the MIT License file for details
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
AliyunpanSDK-Android
This is the open-source SDK for Aliyunpan-Android OpenAPI.
Getting Started
To begin using the sdk, visit our guide that will walk you through the setup process:
Guide
Quick start
1. Create client
PKCE (recommend)
Server
2. Send Command
Advanced Usage
Kotlin
Download
Upload
Documents
Documents
About Repositories
Add it in your root build.gradle at the end of repositories:
Requirements
License
This project is licensed under the MIT License - see the MIT License file for details