1. 导入依赖
implementation 'cn.leancloud:storage-android:8.1.4'
implementation 'cn.leancloud:realtime-android:8.1.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
2. 初始化
- 创建:/app/src/main/kotlin/package/App.kt
class App : Application() {
override fun onCreate() {
super.onCreate()
LeanCloud.setLogLevel(LCLogger.Level.DEBUG)
LeanCloud.initialize(
,
,
,
)
LCIMOptions.getGlobalOptions().setDisableAutoLogin4Push(true)
PushService.startIfRequired(android.content.Context context)
}
}
- 修改:/app/src/main/AndroidManifest.xml
<--! 添加网络权限 -->
<uses-permission android:name="android.permission.INTERNET