百度智能云

All Product Document

          Object Storage

          SDK Installation

          Installation Steps

          1.Download the SDK package on the Official Website.

          2.Unzip to get jar package. At present, JAR package should contain three files, namely: bos-android-sdk-1.0.X.jar, okhttp-3.x.x.jar and okio-1.x.x.jar.

          3.Copy the jar package to your Android project's lib (libs) directory.

          4.In the Eclipse Right-click Project > Properties > Java Build Path > Add JARs, import the jar package you just copied.

          In Android Studio Right-click Item > Open Module Settings > Select Project Module-> Dependencies >+, select File dependency, and select the copied jar package in the lib (libs) directory to complete the import.

          Note: Starting from version 1.0.3, the BOS android SDK will no longer use Apache HttpClient, but more portable and efficient OKHttp. For the specific contents, please see the official website: http://square.github.io/okhttp/

          Privilege Configuration

          Please make sure that the following privileges have been configured in the AndroidManifest.xml file in your project, otherwise, the SDK will not function properly.

          <uses-privilege android:name="android.privilege.INTERNET"/> 
          <uses-privilege android:name="android.privilege.READ_PHONE_STATE"/> 
          <uses-privilege android:name="android.privilege.ACCESS_WIFI_STATE"/> 
          <uses-privilege android:name="android.privilege.ACCESS_NETWORK_STATE"/> 
          <uses-privilege android:name="android.privilege.WRITE_EXTERNAL_STORAGE"/> 

          Configure Obfuscation Protocol

          -dontwarn com.baidubce.** 
          -keep class com.baidubce.**{*;} 
          -keep interface com.baidubce.**{*;} 

          SDK's Directory Structure

          com.baidubce
                 ├── auth                                        //BCE's signature 
                 ├── http                                        //BCE's Http communication related class 
                 ├── internal                                    //SDK's internal class
                 ├── model                                       //BCE's public model class
                 ├── services
                 │       └── bos                                 //BOS service related class 
                 │           ├── model                           //Internal model of BOS, such as Request or Response 
                 │           ├── BosClient.class                 //BOS client entry class 
                 │           └── BosClientConfiguration.class    //Configuration for BOS-specific HttpClient
                 │       └── sts                                 //STS service related class 
                 │           └── model                           //Internal model of STS 
                 ├── util                                        //BCE's utility tool class 
                 ├── BceClientConfiguration.class                //Configuration of BCE's HttpClient 
                 ├── BceClientException.class                    //Exception class of BCE's client 
                 ├── BceServiceException.class                   //The exception class after interacting with the BCE's server 
                 ├── ErrorCode.class                             //BCE's general error code 
                 └── Region.class                                //BCE's service region 
          Previous
          Overview
          Next
          Initialization