Skip to main content

Platform Setup

Complete the platform-specific setup to enable DOTA updates in your app.

Android Setup

In order to integrate DOTA into your Android project, perform the following steps:

  1. Edit android/settings.gradle and add the DOTA module:
// ...
include ':app', ':d11_dota'
project(':d11_dota').projectDir = new File(rootProject.projectDir, '../node_modules/@d11/dota/android/app')
  1. In android/app/build.gradle, add the dependency:
dependencies {
// ...
implementation project(':d11_dota')
// ...
}
  1. In android/app/build.gradle, apply the DOTA build tasks at the end of the file:
// ...
apply from: "../../node_modules/@d11/dota/android/codepush.gradle"
// ...
  1. Update MainApplication to use DOTA:
// 1. Import the plugin class.
import com.microsoft.codepush.react.CodePush

class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
// ...

// 2. Add DOTA package for manual linking
add(
CodePush.getInstance(
resources.getString(R.string.CodePushDeploymentKey),
applicationContext,
BuildConfig.DEBUG
)
)

// 3. Let DOTA determine the JS bundle location on each start
override fun getJSBundleFile(): String {
return CodePush.getJSBundleFile()
}
}
}
  1. Add the deployment key and server URL to strings.xml:
<resources>
<!-- ... -->
<string moduleConfig="true" name="CodePushDeploymentKey">DeploymentKey</string>
<string moduleConfig="true" name="CodePushServerUrl"><server-url></string>
</resources>
  1. Disable autolinking for @d11/dota by creating react-native.config.js at the app root:
module.exports = {
dependencies: {
'@d11/dota': {
platforms: {
android: null,
},
},
},
};