GPVersionChecker

Additional

Language
Kotlin
Version
1.0.8 (Sep 19, 2016)
Created
Mar 6, 2016
Updated
Apr 15, 2023 (Retired)
Owner
Vadim Shchenev (robohorse)
Contributors
Shigeaki Matsumura (matsu911)
Vadim Shchenev (robohorse)
Chayan Mistry (chayanforyou)
3
Activity
Badge
Generate
Download
Source code

Advertisement

GPVersionChecker

Android Library for checking the current uploaded version on the Google Play

Quick start

  1. Just add this dependency into your build.gradle
 repositories {
     mavenCentral()
     maven { url "https://jitpack.io" }
 }

and:

 implementation 'com.github.robohorse:gpversionchecker:1.8.0'
 implementation 'org.jsoup:jsoup:1.9.2'
  1. Add
   GPVersionChecker.Builder(this).create()

into your Activity.kt

 override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        GPVersionChecker.Builder(this).create()
    }

Now you can see this awesome dialog window:

This library does not produce memory leaks - all context usages are leak-safe.

Customization

• Dialog window customization

You can override string resource, that you want:

    <string name="app_name">GPVersionChecker</string>

    <string name="gpvch_header">New version is available!</string>
    <string name="gpvch_button_positive">Update current version</string>
    <string name="gpvch_button_negative">Remind me later</string>
    <string name="gpvch_new_version_info_title">Whats new:</string>

also, you can override dimensions for default dialog window

    <dimen name="gpvch_app_icon_margin">10dp</dimen>

    <dimen name="gpvch_tv_version_code_margin_left">5dp</dimen>
    <dimen name="gpvch_tv_version_code_margin_right">5dp</dimen>
    <dimen name="gpvch_tv_version_code_margin_top">10dp</dimen>

    <dimen name="gpvch_tv_header_whats_new">5dp</dimen>

image by overriding gpvch_app_icon.xml

   <?xml version="1.0" encoding="utf-8"?>
   <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/ic_launcher" />

• Version checking strategy

Add this to builder, and dialog will be shown once in day

.setCheckingStrategy(CheckingStrategy.ONE_PER_DAY)

• Usage info response only

The following code will block showing of the default dialog window, but gives information about current uploaded version

    GPVersionChecker.Builder(activity = this)
            .setVersionInfoListener(object : VersionInfoListener {
                
                override fun onResulted(version: Version?) {
                    //TODO: Show your custom dialog here
                }
                
                override fun onErrorHandled(throwable: Throwable?) {
                    //TODO: Show your custom error notification here
                }
                
            }).create()

ProGuard

Add the following to proguard-project.txt:

-keep public class org.jsoup.** {
public *;
}

About

Copyright 2016 Vadim Shchenev, and licensed under the MIT license. No attribution is necessary but it's very much appreciated. Star this project if you like it.