Skip to content

zorouyang/upgrade_in_app

Repository files navigation

Gradle with jitpack

Features

  • Check versoin with url response
  • Force upgrade in app
  • Flexible upgrade with DownloadManager API
  • Force and flexible upgrade with Play core API for Android 5.0 or later

Screenshot

Force upgrade

(Upgrade in app)

Flexible/background upgrade

(DownloadManager API)

Force and flexible upgrade with play store

(Play core API) Android 5.0 above




please see:
https://developer.android.google.cn/guide/app-bundle/in-app-updates

How to Usage:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.zorouyang:upgrade_in_app:0.1'
}

Code

Check versoin with url response

CheckUpdateManager.checkUpdate(context, url)
Response: 
{
  "statusCode": 0,
  "message": "",
  "upgradeInfo": {
    "versionCode": 31,
    "versionName": "3.2.2",
    "downloadUrl": "https://domain/url/",
    "title": "有新版本",
    "changelog": "新版本v3.2.2\n更多內容\n更穩定\n建議立即更新",
    "forceUpgrade": true,//true/false
    "updateButton": "立即更新",
    "continueButton": "暫不更新"
  }
}

Force upgrade

UpgradeManager.getInstance().upgrade(context, downloadUrl)

Background upgrade with DownloadManager API

DownloadBackgroundManager.download(context, downloadUrl)

Play store with Play core API on android 5.0 above https://developer.android.com/guide/app-bundle/in-app-updates

new InAppUpgradeManager(activity).forceUpgrade()
new InAppUpgradeManager(activity).flexibleUpdate()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages