You can integrate Datacenter to your project through Native AAR or Portal & Bundle mode. Multiple storage methods such as database storage, key-value pair storage, and file storage can be implemented to meet different business requirements.
Prerequisites
If you want to integrate the component to the mPaaS based on the native AAR mode, you need to first complete the prerequisites and the subsequent steps. For more information, see Add mPaaS to your project.
If you want to integrate the component to the mPaaS based on components, you need to first complete the Component-based integration procedure.
Add the SDK
Native AAR mode
You can use the component management (AAR) function to install the Storage component in your project. For more information, see AAR component management.
Component-based mode
In your Portal and Bundle projects, install the Storage component on the Component Management page.
For more information, see Manage component dependencies.
mPaaS initialization
In the native AAR mode, you must initialize the mPaaS.
Add the following code to the
class:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// mPaaS initialization
MP.init(this);
}
}
For more details, see Initialize mPaaS.
Using storage
If you need to use the database to store related content, see Database storage.
If you need to use the key-value pair to store related content, see Key-value pair storage.
If you need to use the file to store related content, see File storage.
Sample code
See Sample code to obtain sample code.