Integrate ShiplyPro Android SDK
The Shiply Android SDK supports configuration switches, resource artifacts, hotfix, and upgrade features. ShiplyProSDK (shiplyintegration) provides a unified initialization entry point.
I. Privacy and Security Notice
Shiply Pro SDK
Version: 1.0.0
Last Updated: April 23, 2025
SDK Description: Provides mobile developers with dynamic configuration switch delivery, dynamic resource file delivery, in-app upgrade, and online hotfix capabilities
Service Provider: Shenzhen Tencent Computer Systems Co., Ltd.
Integration Guide: Integrate ShiplyPro Android SDK
Privacy Protection Rules: 《Shiply Pro SDK Personal Information Protection Rules》
II. Integration Guide
2.1 Configure Maven Repository
Configure the repository address in build.gradle at the project root:
allprojects {
repositories {
maven { url "https://maven.cnb.cool/tencent-tds/shiply-public/-/packages/" }
}
}
2.2 Add Runtime SDK
Add runtime SDK dependencies in the main module's build.gradle:
dependencies {
// ShiplyPro SDK; required for unified integration
implementation "com.tencent.shiply:shiplyintegration:$shiply_integration_version"
// Shiply config switch SDK; required when using config switches
implementation "com.tencent.shiply:rdelivery:$rdelivery_version"
// Shiply resource artifact SDK; required when using resource artifacts
implementation "com.tencent.shiply:reshub-sdk:$reshub_version"
implementation "com.tencent.shiply:reshub-net:$reshub_version"
implementation "com.tencent.shiply:reshub-report:$reshub_version"
implementation "com.tencent.shiply:reshub-patch-sdk:$reshub_version"
// Shiply in-app upgrade SDK; required when using in-app upgrade
implementation("com.tencent.shiply:upgrade:$upgrade_version")
implementation("com.tencent.shiply:upgrade-ui:$upgrade_version")
implementation("com.tencent.shiply:upgrade-diff-pkg-patch:$upgrade_version")
}
Configure version numbers in gradle.properties
shiply_integration_version=1.0.0
rdelivery_version=1.3.38-RC02
reshub_version=1.8.22-RC03
upgrade_version=2.2.3-RC01
2.3. Initialize SDK
It is recommended to initialize the SDK in the Application.onCreate method:
public class InitUtil {
private static final String TAG = "InitUtil";
public static void initShiplySDK(Application application, RFixApplicationLike rFixApplicationLike) {
String appId = "22d6b1c95b"; // App ID for the Android product created on the Shiply console
String appKey = "594725a2-6e41-4862-a085-a2a6f69dab64"; // App Key for the Android product created on the Shiply console
String bundleID = BuildConfig.APPLICATION_ID; // Host app package name
boolean isDebugPackage = BuildConfig.DEBUG; // Whether the host app is a debug build
ShiplyParams shiplyParams = new ShiplyParams.Builder()
.appId(appId)
.appKey(appKey)
.userId("123321")
.deviceId("deviceXXX")
.hostAppVersion(BuildConfig.VERSION_NAME) // Host app version
.isDebugPackage(isDebugPackage)
.devModel(Build.MODEL)
.devManufacturer(Build.MANUFACTURER)
.androidSystemVersion(String.valueOf(Build.VERSION.SDK_INT))
.logImpl(new CustomLogger()) // Custom logger; recommended to integrate with your own logging interface
.build();
// Initialize ShiplyPro SDK; required for unified integration
ShiplyIntegrationHelper.INSTANCE.initialize(application, shiplyParams);
// Initialize config switch SDK; required when using config switches
ShiplyIntegrationHelper.INSTANCE.getRdeliveryInstance();
// Initialize resource artifact SDK; required when using resource artifacts
ShiplyIntegrationHelper.INSTANCE.getReshubInstance();
// Initialize in-app upgrade SDK; required when using in-app upgrade
ShiplyIntegrationHelper.INSTANCE.initUpgrade(ShiplyIntegrationHelper.UpgradeDiffType.OriginPackage);
ShiplyIntegrationHelper.INSTANCE.getUpgradeInstance();
// Initialize hotfix SDK; required when using hotfix
if (rFixApplicationLike != null) {
ShiplyIntegrationHelper.INSTANCE.initRFix(rFixApplicationLike, new RFixListener() {
@Override
public void onConfig(boolean b, int i, PatchConfig patchConfig) {
Log.d(TAG, "onConfig : " + b + ", " + i);
}
@Override
public void onDownload(boolean b, int i, PatchConfig patchConfig, String s) {
Log.d(TAG, "onDownload : " + b + ", " + i + ", " + s);
}
@Override
public void onInstall(boolean b, int i, RFixPatchResult rFixPatchResult) {
Log.d(TAG, "onInstall : " + b + ", " + i);
}
});
ShiplyIntegrationHelper.INSTANCE.getRFixInstance();
}
}
// Custom logger; recommended to integrate with your own logging interface
public static class CustomLogger extends AbsLog {
@Override
public void log(String tag, Level logLevel, String msg) {
String newTag = "ShiplyDemo_" + tag;
if (logLevel == Level.VERBOSE) {
Log.v(newTag, msg != null ? msg : "");
} else if (logLevel == Level.DEBUG) {
Log.d(newTag, msg != null ? msg : "");
} else if (logLevel == Level.INFO) {
Log.i(newTag, msg != null ? msg : "");
} else if (logLevel == Level.WARN) {
Log.w(newTag, msg != null ? msg : "");
} else if (logLevel == Level.ERROR) {
Log.e(newTag, msg != null ? msg : "");
}
}
@Override
public void log(String tag, Level logLevel, String msg, Throwable throwable) {
String newTag = "ShiplyDemo_" + tag;
if (logLevel == Level.VERBOSE) {
Log.v(newTag, msg, throwable);
} else if (logLevel == Level.DEBUG) {
Log.d(newTag, msg, throwable);
} else if (logLevel == Level.INFO) {
Log.i(newTag, msg, throwable);
} else if (logLevel == Level.WARN) {
Log.w(newTag, msg, throwable);
} else if (logLevel == Level.ERROR) {
Log.e(newTag, msg, throwable);
}
}
}
}
III. Use Configuration Release
3.1 Get SDK Instance
RDelivery rDelivery = ShiplyIntegrationHelper.INSTANCE.getRdeliveryInstance();
3.2 Get Configuration Value
When the remote end does not have this configuration switch key, the configuration has not been pulled, or the web console has not set a value for this key, defaultValue is returned.
String configSwitchName = "testName";
String defaultValue = "";
String configValue = rDelivery.getStringByKey(configSwitchName, defaultValue, true);
3.3 Get Switch Value
When the remote end does not have this configuration switch key, the configuration has not been pulled, or the switch value for this key on the web console is "Not Set", defaultValue is returned.
String configSwitchName = "testName";
boolean defaultValue = false;
boolean switchValue = rDelivery.isOnByKey(configSwitchName, defaultValue, true);
3.4 Get Configuration Object (RDeliveryData)
RDeliveryData defaultConfigSwitchData = null;
RDeliveryData configSwitchData = rDelivery.getRDeliveryDataByKey(configSwitchName, defaultConfigSwitchData, true);
3.5 More Usage
See: Use Configuration and Switches
IV. Use Resource Release
4.1 Get SDK Instance
IResHub reshub = ShiplyIntegrationHelper.INSTANCE.getReshubInstance();
4.2 Download a Specific Resource
reshub.loadLatest(resId, new IResCallback() {
@Override
public void onComplete(boolean isSuccess, IRes result, IResLoadError error) {
if (isSuccess) {
Log.d("ResHubLoad", "Resource fetched successfully");
} else {
Log.e("ResHubLoad", "Failed to fetch latest resource asynchronously");
}
}
});
4.3 Read Resources Downloaded Locally
IRes res = reshub.getLatest(resId);
4.4 More Usage
V. Use In-App Upgrade
5.1 Get SDK Instance
UpgradeManager upgradeManager = ShiplyIntegrationHelper.INSTANCE.getUpgradeInstance();
5.2 Check for Updates
upgradeManager.checkUpgrade(false, null, new DefaultUpgradeStrategyRequestCallback());
5.3 More Usage
VI. Use Hotfix
Hotfix SDK integration is relatively complex. For details, see: Use Hotfix SDK. When using ShiplyPro integration, you do not need to create RFixParams.
Replace RFixInitializer.initialize in section 2.3 of the hotfix integration guide with:
ShiplyIntegrationHelper.INSTANCE.initRFix(rFixApplicationLike, new RFixListener() {
@Override
public void onConfig(boolean b, int i, PatchConfig patchConfig) {
Log.d(TAG, "onConfig : " + b + ", " + i);
}
@Override
public void onDownload(boolean b, int i, PatchConfig patchConfig, String s) {
Log.d(TAG, "onDownload : " + b + ", " + i + ", " + s);
}
@Override
public void onInstall(boolean b, int i, RFixPatchResult rFixPatchResult) {
Log.d(TAG, "onInstall : " + b + ", " + i);
}
});
ShiplyIntegrationHelper.INSTANCE.getRFixInstance();
VII. ShiplyPro Sample App
The ShiplyPro sample app provides example code for using the ShiplyPro SDK. You can learn how to use the ShiplyPro SDK through the sample code.