0
0

More than 3 years have passed since last update.

HUAWEI Driveのフォルダの種類

  1. ユーザーに見える普通のフォルダ
  2. ユーザーに見えないアプリケーションフォルダ(隠しフォルダ)

上記の2種類あります。

HUAWEI Driveのフォルダの作成手順

  1. HUAWEI Driveに接続する
  2. com.huawei.cloud.services.drive.model.Fileオブジェクトを生成する(フォルダはファイルの一種)
  3. com.huawei.cloud.services.drive.model.FileオブジェクトをHUAWEI Driveに渡して、実行する

注意点
1. mimeTypeに"application/vnd.huawei-apps.folder"をセットする
2. アプリケーションフォルダの場合、親フォルダのパラメータに{"applicationData"}をセットする

サンプル

private var drive: Drive? = null

fun createFolder(folderName: String, isApplicationFolder: Boolean): com.huawei.cloud.services.drive.model.File? {
    drive?.let { drive ->
        val appProperties: Map<String, String> = mutableMapOf("appProperties" to "property")
        val file = com.huawei.cloud.services.drive.model.File()
            .setFileName(folderName)
            .setMimeType("application/vnd.huawei-apps.folder")
            .setAppSettings(appProperties).apply {
                if (isApplicationFolder) {
                    parentFolder = listOf("applicationData")
                }
            }
        return drive.files().create(file).execute()
    }

    return null
}

GitHub

HMS Drive Kit Demo : https://github.com/Rei2020GitHub/MyPublicProject/tree/master/DriveKitDemo

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0