Touch these files when integrating SrcPush in a bare React Native Android app:
android/app/build.gradleandroid/app/src/main/res/values/strings.xmlandroid/app/src/main/java/.../MainApplication.(kt|java)android/app/src/main/AndroidManifest.xmlwhen the library or app requires metadata flags
Add the package Gradle helper near the other apply from: lines:
apply from: "../../node_modules/@srcpush/react-native-code-push/android/codepush.gradle"Prefer placeholders instead of real deployment keys in git:
buildTypes {
debug {
resValue "string", "CodePushDeploymentKey", '"YOUR_ANDROID_STAGING_KEY"'
}
release {
resValue "string", "CodePushDeploymentKey", '"YOUR_ANDROID_PRODUCTION_KEY"'
}
}If the project already keeps CodePushDeploymentKey in strings.xml, keep a single source of truth. Do not duplicate values across both mechanisms unless the app already depends on that pattern.
Add or preserve these keys:
<string name="CodePushDeploymentKey">YOUR_ANDROID_DEPLOYMENT_KEY</string>
<string name="CodePushServerUrl">https://api.srcpush.com</string>
<string name="CodePushPublicKey">YOUR_PUBLIC_KEY</string>CodePushServerUrl and CodePushPublicKey are optional unless the backend configuration requires them.
Import CodePush and override getJSBundleFile() inside the ReactNativeHost:
import com.microsoft.codepush.react.CodePush
override fun getJSBundleFile(): String {
return CodePush.getJSBundleFile()
}React Native version changes may alter the exact host class shape. Preserve the project’s current DefaultReactNativeHost or legacy host pattern and only add the override where it belongs.
Touch these files when integrating SrcPush in a bare React Native iOS app:
ios/Podfileios/<AppTarget>/AppDelegate.mmorAppDelegate.mios/<AppTarget>/Info.plist
Add the pod when required by the project:
pod 'CodePush', :path => '../node_modules/@srcpush/react-native-code-push'Run pod install after changing pods.
Import the header and return the SrcPush bundle in release builds:
#import <CodePush/CodePush.h>
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [CodePush bundleURL];
#endif
}If the app already customizes sourceURLForBridge, keep all existing behavior and only replace the release bundle location.
Add placeholders, not secrets:
<key>CodePushDeploymentKey</key>
<string>YOUR_IOS_DEPLOYMENT_KEY</string>
<key>CodePushServerURL</key>
<string>https://api.srcpush.com</string>
<key>CodePushPublicKey</key>
<string>YOUR_PUBLIC_KEY</string>Do not add ATS exceptions unless the deployment endpoint actually needs them.
Typical wrapper:
import codePush from '@srcpush/react-native-code-push';
const codePushOptions = {
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESTART,
mandatoryInstallMode: codePush.InstallMode.IMMEDIATE,
updateDialog: false,
};
export default codePush(codePushOptions)(App);If the app needs a custom modal or progress UI, call codePush.checkForUpdate() and codePush.sync() manually instead of relying only on the HOC defaults.