项目作者: GauthamAsir

项目描述 :
Simple App Updater From Github releases and App version Name
高级语言: Java
项目地址: git://github.com/GauthamAsir/AppUpdater.git
创建时间: 2020-04-28T11:39:55Z
项目社区:https://github.com/GauthamAsir/AppUpdater

开源协议:

下载


AppUpdater

How to include to your project

Add the repository to your project build.gradle:

  1. repositories {
  2. maven {
  3. url "https://jitpack.io"
  4. }
  5. }

And add the library to your module build.gradle:

  1. dependencies {
  2. implementation 'com.github.GauthamAsir:AppUpdater:1.1'
  3. }

Instructions

Library compares the App version name & Github Tag Name.
It has native downloader which downloads the apk from github releases and
It installs the apk after download is completed.

Note

Github Tag Name should not contain any alphabets, it can be decimal (Eg: 1.1)
Make sure you enter proper Github Username and Repo

Usage

Displaying a dialog, Snackbar notification or activity

Dialog

  1. AppUpdater appUpdater = new AppUpdater(this);
  2. appUpdater.setDisplay(Display.DIALOG);
  3. appUpdater.setUpGithub("username", "reponame");
  4. appUpdater.start();

For SnackBar

  1. AppUpdater appUpdater = new AppUpdater(this);
  2. appUpdater.setDisplay(Display.SNACKBAR);
  3. appUpdater.setUpGithub("username", "reponame");
  4. appUpdater.start();

For Notification

  1. AppUpdater appUpdater = new AppUpdater(this);
  2. appUpdater.setDisplay(Display.NOTIFICATION);
  3. appUpdater.setUpGithub("username", "reponame");
  4. appUpdater.start();

On Click of Notification it navigates to the Update Activity.

Activity

It handles the changelogs also, which is the release description from Github

  1. Intent updateIntent = new Intent(getApplicationContext(),UpdateActivity.class);
  2. updateIntent.putExtra("username","GauthamAsir");
  3. updateIntent.putExtra("repoName","AppUpdater");
  4. startActivity(updateIntent);

Customizations

Customizing Dialog

Dialog Style
  1. appUpdater.setDialogStyle(R.style.dialogAlertStyle);
  1. <style name="dialogAlertStyle" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
  2. <item name="colorPrimary">@color/colorAccent</item>
  3. <item name="colorSecondary">@color/colorAccent</item>
  4. </style>
Dialog Buttons Text
  1. appUpdater.setDialogBtnPositive("Update");
  2. appUpdater.setDialogBtnNegative("Dismiss");
Dialog Icon
  1. appUpdater.setDialog_icon(R.drawable.ic_system_update_black_24dp);
Dialog Title
  1. appUpdater.setDialogTitle("new title");
Dialog Message
  1. appUpdater.setDialogMessage("message");
Dialog Set Cancelable

By default its false

  1. appUpdater.setDialogCancelable(true);