Skip to content

Latest commit

 

History

History

cloudstorage

CloudStorage quickstart

English | 中文

Contents

Introduction

This demo demonstrates an example of using the SDK to store images, videos, audio, or other files generated by users.

Environment Requirements

  • A computer with Android Studio installed for app development
  • A device or an emulator in Android Studio running Android 4.2 or a later version

Getting Started

  1. Enable Cloud Storage in AppGallery Connect. The Cloud Storage service is not enabled by default.

  2. Create a storage instance. When Cloud Storage is enabled, AppGallery Connect automatically creates a default storage instance. If you want to store app system data and user data separately, create a storage instance as required.

  3. Integrate the Cloud Storage SDK if you need to use Cloud Storage-related functions in your app.

  4. Initialize the storage instance. Before using Cloud Storage on an app, you must initialize the default storage instance or a storage instance in the specified region.

  5. Manage files. The app can call the APIs of the Cloud Storage SDK to perform operations such as uploading files, downloading files, deleting files, and modifying file metadata.

For more development details, please refer to: Development guide: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-cloudstorage-sdkchangenotes-android-0000001055246188

API reference: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/overview-0000001055088626

Sample Code

Sample code: /app/src/main/java/com/huawei/agc/quickstart/storage/MainActivity.java

Java sample code: /app/src/main/java/com/huawei/agc/quickstart/storage/MainActivity.java

Kotlin sample code: /kotlin-app/src/main/java/com/huawei/agconnect/kotlindemo/MainActivityKotlin.kt

Technical Support

If you have any questions about the sample code, try the following:

  • Visit Stack Overflow, submit your questions, and tag them with appgallery. Huawei experts will answer your questions.
  • Go to AppGallery in the HUAWEI Developer Forum and communicate with other developers.

If you encounter any issues when using the sample code, submit your issues or submit a pull request.

License

The sample code is licensed under the Apache License, version 2.0.