Code Monkey home page Code Monkey logo

appupdate's Introduction

App Update

Library to check app updates

alt text

Installation

Maven

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>


<dependency>
    <groupId>com.github.MarsadMaqsood</groupId>
    <artifactId>AppUpdate</artifactId>
    <version>0.1.+</version>
</dependency>

Gradle

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


dependencies {
        implementation 'com.github.MarsadMaqsood:AppUpdate:0.1.+'
}

setTime(long miliseconds)
setUrl(String url)
setNotificationIcon(Drawable icon)
setUpdateTitle(String updatetitle)
setUpdateContentText(String updateContentText)
setDownloadDialogTitle(String title)
setToastMsg(String message)
setIsShowBackgroundDownload(boolean value)
setIsShowNetworkErrorToast(boolean value)
setIsShowToast(boolean value)
setCustomsActivity(class cls)
setCallback(CheckUpdateTask.Callback calback)

Json Structure

{
    "versionCode":VERSION_CODE,                    //int
    "versionName":"VERSION_NAME",                  //string
    "contentText":"DIALOG_CONTENT_TEXT",           //string
    "minSupport":MINIMUM_SUPPORTED_VERSION_CODE,   //int
    "url":"APP_DOWNLOAD_URL"                       //string
}

How to Use

UpdateWrapper updateWrapper = new UpdateWrapper.Builder(this)
        //set time in millisecounds
        .setTime(3000)
        //set notification icon
        .setNotificationIcon(R.mipmap.ic_launcher)
        //set update file url
        .setUrl("https://marsad.dev/update.json")
        //set custom update dialog title //Default is "Update Available"
        .setUpdateTitle("Custom Title Here")
        //set custom update dialog content if empty then text from json set
        .setUpdateContentText("Content Text Here")
        //set customs download dialog title
        .setDownloadDialogTitle("Title Here")
        //set customs activity
        .setCustomsActivity(cls)
        //set showToast. default is true
        .setIsShowToast(false)
        //add callback ,return new version info
        .setCallback((model, hasNewVersion) -> {
            Log.d("Latest Version", hasNewVersion + "");
            Log.d("Version Name", model.getVersionName());
            Log.d("Version Code", model.getVersionCode() + "");
            Log.d("Version Description", model.getContent());
            Log.d("Min Support", model.getMinSupport() + "");
            Log.d("Download URL", model.getUrl());
        })
        .build();

updateWrapper.start();

License

Apache License 2.0. See the LICENSE file for details.

appupdate's People

Contributors

marsadmaqsood avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.