An Android SDK for managing application version checking, automatic/manual updates, direct APK downloading and installation, market store redirection, and app sharing across Android applications.
Add JitPack in your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}Add the SDK dependency to your app module's build.gradle.kts:
dependencies {
implementation("com.github.ayantech:versioncontrol:LAST_VERSION")
}Ensure internet permission is declared in your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />VersionControlCore.getInstance("BASE_URL")
.setApplicationName("myApplicationName")
.setCategoryName("market")
.checkForNewVersion(activity)Apply a custom font to the version control update dialog:
val customTypeface = Typeface.createFromAsset(assets, "fonts/my_custom_font.ttf")
VersionControlCore.getInstance("BASE_URL")
.setApplicationName("myApplicationName")
.setCategoryName("market")
.setTypeface(customTypeface)
.checkForNewVersion(this)Launch the native sharing intent with the application store link:
VersionControlCore.getInstance("BASE_URL")
.setApplicationName("myApplicationName")
.setCategoryName("market")
.shareApp(context)The host application must provide both colocation service URLs. The SDK first calls the Iran1 service and calls the International service only when Iran1 has a network/ HTTP failure, returns a non-success status, or returns no usable endpoints.
lifecycleScope.launch {
val result = VersionControlCore.getInstance("DEFAULT_VERSION_CONTROL_BASE_URL")
.setIranBaseUrl("IRAN_1_COLOCATION_BASE_URL")
.setInternationalBaseUrl("INTERNATIONAL_COLOCATION_BASE_URL")
.setApplicationName("myApplicationName")
.setApplicationVersion(VersionControlCore.getApplicationVersion(this@MainActivity))
.getApplicationColocationConfig(this@MainActivity)
result.fold(
onSuccess = { config ->
// Use config.endpointList or config.versionControlBaseUrl.
},
onFailure = { error ->
// Both services failed; show or otherwise handle the final error.
}
)
}ProGuard rules are bundled with the library. If custom obfuscation is active, ensure these rules are included:
-keep public class ir.ayantech.versioncontrol.** { *; }
-keep class ir.ayantech.versioncontrol.data.remote.dto.** { *; }
-keep class ir.ayantech.versioncontrol.model.** { *; }
-keep class ir.ayantech.versioncontrol.domain.model.** { *; }
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}