Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

kibotu/GooglePlayForceUpdate

 
 

Repository files navigation

GooglePlayForceUpdate

Android Arsenal Build Status API Gradle Version Licence Retrolambda Javadoc

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

#Quick start

How to install

repositories {
    maven {
        url "https://jitpack.io"
    }
}
	
dependencies {
    compile 'com.github.kibotu:GooglePlayForceUpdate:SNAPSHOT'
}

How to build the lib

gradle clean lib:build

How to use

Add

  new GPVersionChecker.Builder(this).create();

into your Activity.java

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        new GPVersionChecker.Builder(this)
                .setCheckingStrategy(CheckingStrategy.ALWAYS)
                // .forceUpdate(false) // removes possibility to skip the update dialog, default is false
                // .setCustomPackageName("com.sample") // for debugging purposes while the app is not published in stores yet
                // .showDialog(false) default true
                .setVersionInfoListener(version -> Log.v(TAG, "version=" + version))
                .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">GooglePlayForceUpdate</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>

    <dimen name="gpvch_tv_changes_margin_left">5dp</dimen>
    <dimen name="gpvch_tv_changes_margin_right">5dp</dimen>
    <dimen name="gpvch_tv_changes_margin_bottom">10dp</dimen>

    <integer name="gpvch_tv_changes_max_lines">4</integer>

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" />

or colors

    <color name="gpvch_dialog_text_color">@color/gpvch_black</color>

• 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

 new GPVersionChecker.Builder(this)
                .setVersionInfoListener(new VersionInfoListener() {
                   
                    @Override
                    public void onResulted(Version version) {
                        
                    }
                })
                .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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.5%
  • HTML 1.5%