📜  Cloudrail-Android(1)

📅  最后修改于: 2023-12-03 15:14:10.643000             🧑  作者: Mango

Cloudrail-Android

Cloudrail-Android is a powerful SDK that simplifies the integration of various cloud services in Android applications. With only a few lines of code, developers can easily add authentication, downloading, uploading, and other functionalities to cloud services such as Google Drive, Dropbox, Box, OneDrive, and SharePoint.

Features
  • Easy-to-use SDK for integrating multiple cloud services
  • Support for various functionalities of the cloud services, including uploading, downloading, sharing, and deleting files and folders
  • Built-in authentication and account management features
  • Comprehensive documentation and sample codes to accelerate development
Installation

Cloudrail-Android can be installed easily via Gradle. Simply add the following line to the dependencies section in your app-level build.gradle file:

implementation 'com.cloudrail:cloudrail-si-android:2.28.1'
Usage

Cloudrail-Android follows a unified interface for all supported cloud services, making it easy to switch between services and perform common actions.

To use a specific cloud service, you need to follow three steps:

  1. Create an instance of the service:
CloudStorage service = new Dropbox(context, "<clientID>", "<clientSecret>", "<redirectUri>");
  1. Authenticate the user:
service.login(context, new CloudRail.SuccessCallback() {
    @Override
    public void onCompletion(Object result) {
        System.out.println("Login success!");
    }
}, new CloudRail.ErrorCallback() {
    @Override
    public void onError(CloudRailException e) {
        System.out.println("Login failed: " + e.getMessage());
    }
});
  1. Perform the desired operations:
service.upload("/path/to/local/file", "/destination/path/on/cloud", new CloudRail.ProgressHandler() {
    @Override
    public void onUploadProgress(long uploadedBytes, long totalBytes) {
        System.out.printf("Uploaded %d bytes of %d\n", uploadedBytes, totalBytes);
    }
}, new CloudRail.SuccessCallback() {
    @Override
    public void onCompletion(Object result) {
        System.out.println("File uploaded successfully!");
    }
}, new CloudRail.ErrorCallback() {
    @Override
    public void onError(CloudRailException e) {
        System.out.println("Upload failed: " + e.getMessage());
    }
});

For more information about how to use Cloudrail-Android, please refer to the official documentation.

Conclusion

With Cloudrail-Android, developers can easily integrate multiple cloud services in their Android applications while keeping the codebase simple and maintainable. By providing a unified interface and comprehensive documentation, Cloudrail-Android makes the development process seamless and enables developers to focus on creating more value for their users.