Skip to content

Repository files navigation

AyanTech Version Control SDK for Android

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.


📦 Adding the SDK to Your Project

1. Configure Repositories

Add JitPack in your settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

2. Add Dependency

Add the SDK dependency to your app module's build.gradle.kts:

dependencies {
    implementation("com.github.ayantech:versioncontrol:LAST_VERSION")
}

3. Permissions

Ensure internet permission is declared in your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

🚀 How to Use

1. Check for New Version

VersionControlCore.getInstance("BASE_URL")
    .setApplicationName("myApplicationName")
    .setCategoryName("market")
    .checkForNewVersion(activity)

2. Custom Typeface (Optional)

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)

3. Share Application

Launch the native sharing intent with the application store link:

VersionControlCore.getInstance("BASE_URL")
    .setApplicationName("myApplicationName")
    .setCategoryName("market")
    .shareApp(context)

4. Resolve Colocation Endpoints

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 / R8 Rules

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>;
}

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages