allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Pidsamhai:GitRelease:<latest-version>'
// This project uses kotlinx-coroutines.
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
}
Permission AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
Add file provider in application tag
<provider
android:authorities="{Your package name}.provider"
android:name="androidx.core.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath"/>
</provider>
filepath.xml res > xml
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-files-path name="files" path="." />
</paths>
class MainActivity : AppCompatActivity(), GitRelease.OnCheckReleaseListener {
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val owner = "Pidsamhai" // Owner Name
val repo = "release_file_test" // Repository name
val currentVersion = BuildConfig.VERSION_NAME
val gitRelease = GitRelease(this, owner, repo, currentVersion).apply {
loading = true
checksum = true
darkTheme = false
progressColor = Color.YELLOW
}
gitRelease.checkNewVersion(this)
checkVersion.setOnClickListener {
gitRelease.checkNewVersion()
}
}
override fun onComplete() {
Log.i(TAG, "onComplete: ")
}
override fun onCancel() {
Log.i(TAG, "onCancel: ")
}
override fun onCancelDownload() {
Log.i(TAG, "onCancelDownload: ")
}
override fun onCancelUpdate() {
Log.i(TAG, "onCancelUpdate: ")
}
}
- checksum.json
- support md5,sha1,sha256
- If you don't want set checksum = false
{
"algorithm": "sha256",
"type": {
"md5": "265fd1f1bec425d4cfa2c7d3de80e669",
"sha1": "78e2f1e29ac419ecd22a2da80e2971280bf08cc7",
"sha256": "21ce8d224db9a70596f5fd4556d7bae8b3f1304ffdf954ebb649830fa2493cf8"
}
}
- fix serialize error when enable minify
- update listener
- fix message color loading dialog
- fix listener
- add Dark Theme
- add check version callback
- fix cancel check version
- remove Markdown View
- render markdown with MarkWon
- Fix missing new version check
- add Toast massage for latest version
- fix markdown lint check (codacy)
- use Markdown View. You can use MarkDown template for changelog massage.
- add checksum support
- initial release
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2020 Pidsamhai <meng348@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.