├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── eu │ │ │ └── dkaratzas │ │ │ └── android │ │ │ └── inapp │ │ │ └── update │ │ │ └── sample │ │ │ ├── Immediate.java │ │ │ ├── FlexibleDefaultSnackbar.java │ │ │ ├── FlexibleWithCustomNotification.java │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── eu │ │ │ └── dkaratzas │ │ │ └── android │ │ │ └── inapp │ │ │ └── update │ │ │ └── sample │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── eu │ │ └── dkaratzas │ │ └── android │ │ └── inapp │ │ └── update │ │ └── sample │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── eu │ │ │ └── dkaratzas │ │ │ └── android │ │ │ └── inapp │ │ │ └── update │ │ │ ├── Constants.java │ │ │ ├── InAppUpdateStatus.java │ │ │ └── InAppUpdateManager.java │ ├── test │ │ └── java │ │ │ └── eu │ │ │ └── dkaratzas │ │ │ └── android │ │ │ └── inapp │ │ │ └── update │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── eu │ │ └── dkaratzas │ │ └── android │ │ └── inapp │ │ └── update │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── docs └── javadoc │ ├── package-list │ ├── script.js │ ├── allclasses-noframe.html │ ├── allclasses-frame.html │ ├── eu │ └── dkaratzas │ │ └── android │ │ └── inapp │ │ └── update │ │ ├── package-frame.html │ │ ├── package-tree.html │ │ ├── package-summary.html │ │ ├── InAppUpdateManager.InAppUpdateHandler.html │ │ ├── Constants.html │ │ ├── InAppUpdateStatus.html │ │ └── Constants.UpdateMode.html │ ├── index.html │ ├── deprecated-list.html │ ├── constant-values.html │ ├── overview-tree.html │ ├── help-doc.html │ └── stylesheet.css ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── bintray.gradle ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── .travis.yml ├── gradle.properties ├── .gitignore ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | -------------------------------------------------------------------------------- /docs/javadoc/package-list: -------------------------------------------------------------------------------- 1 | eu.dkaratzas.android.inapp.update 2 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Sample 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android In-App Update Library 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dioKaratzas/android-inapp-update/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #48B19B 4 | #32323B 5 | #FF6859 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 15 17:51:38 EET 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library/src/main/java/eu/dkaratzas/android/inapp/update/Constants.java: -------------------------------------------------------------------------------- 1 | package eu.dkaratzas.android.inapp.update; 2 | 3 | public class Constants { 4 | 5 | public enum UpdateMode { 6 | FLEXIBLE, 7 | IMMEDIATE 8 | } 9 | 10 | public static final int UPDATE_ERROR_START_APP_UPDATE_FLEXIBLE = 100; 11 | public static final int UPDATE_ERROR_START_APP_UPDATE_IMMEDIATE = 101; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Describe the solution you'd like** 8 | A clear and concise description of what you want to happen. 9 | 10 | **Describe alternatives you've considered** 11 | A clear and concise description of any alternative solutions or features you've considered. 12 | 13 | **Additional context** 14 | Add any other context or screenshots about the feature request here. 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /docs/javadoc/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behaviour including how the prompt builder is created: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Stack trace** 24 | If applicable, add the stack trace for the exception thrown to help trace your problem. 25 | 26 | **Smartphone (please complete the following information):** 27 | - Device: [e.g. Google Pixel] 28 | - OS: [e.g. Android 7.1 Nougat API 25] 29 | - Library version [e.g. 1.0.0] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | sudo: required 3 | jdk: oraclejdk8 4 | 5 | env: 6 | global: 7 | - ANDROID_API_LEVEL=28 8 | - ANDROID_BUILD_TOOLS_VERSION=28.0.3 9 | - ANDROID_ABI=armeabi-v7a 10 | 11 | android: 12 | components: 13 | - tools 14 | - platform-tools 15 | - tools 16 | - extra-android-m2repository 17 | licenses: 18 | - 'android-sdk-preview-license-52d11cd2' 19 | - 'android-sdk-license-.+' 20 | - 'google-gdk-license-.+' 21 | 22 | before_install: 23 | - touch $HOME/.android/repositories.cfg 24 | - yes | sdkmanager "platforms;android-28" 25 | - yes | sdkmanager "build-tools;28.0.3" 26 | 27 | before_cache: 28 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 29 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 30 | 31 | cache: 32 | directories: 33 | - $HOME/.gradle/caches/ 34 | - $HOME/.gradle/wrapper/ 35 | - $HOME/.android/build-cache 36 | 37 | before_script: 38 | - chmod +x gradlew 39 | 40 | script: 41 | - ./gradlew clean build 42 | - ./gradlew test 43 | 44 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /library/src/test/java/eu/dkaratzas/android/inapp/update/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.*; 22 | 23 | /** 24 | * Example local unit test, which will execute on the development machine (host). 25 | * 26 | * @see Testing documentation 27 | */ 28 | public class ExampleUnitTest { 29 | @Test 30 | public void addition_isCorrect() { 31 | assertEquals(4, 2 + 2); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/test/java/eu/dkaratzas/android/inapp/update/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update.sample; 18 | 19 | import org.junit.Test; 20 | 21 | import static org.junit.Assert.*; 22 | 23 | /** 24 | * Example local unit test, which will execute on the development machine (host). 25 | * 26 | * @see Testing documentation 27 | */ 28 | public class ExampleUnitTest { 29 | @Test 30 | public void addition_isCorrect() { 31 | assertEquals(4, 2 + 2); 32 | } 33 | } -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | version = '1.0.5' 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "30.0.1" 8 | 9 | defaultConfig { 10 | minSdkVersion 14 11 | targetSdkVersion 30 12 | versionCode 1 13 | versionName "1.0.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | 31 | implementation 'com.google.android.play:core:1.10.0' 32 | implementation 'androidx.annotation:annotation:1.2.0' 33 | implementation 'androidx.lifecycle:lifecycle-runtime:2.3.1' 34 | annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.3.1' 35 | implementation 'com.google.android.material:material:1.3.0' 36 | testImplementation 'junit:junit:4.13' 37 | androidTestImplementation 'androidx.test:runner:1.3.0' 38 | } 39 | 40 | apply from: "${rootDir}/gradle/bintray.gradle" 41 | 42 | 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | *.aab 5 | 6 | # Files for the ART/Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | out/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea/* 39 | 40 | # Keystore files 41 | # Uncomment the following lines if you do not want to check your keystore files in. 42 | #*.jks 43 | #*.keystore 44 | 45 | # External native build folder generated in Android Studio 2.2 and later 46 | .externalNativeBuild 47 | 48 | # Google Services (e.g. APIs or Firebase) 49 | # google-services.json 50 | 51 | # Freeline 52 | freeline.py 53 | freeline/ 54 | freeline_project_description.json 55 | 56 | # fastlane 57 | fastlane/report.xml 58 | fastlane/Preview.html 59 | fastlane/screenshots 60 | fastlane/test_output 61 | fastlane/readme.md 62 | 63 | # OS-specific files 64 | .DS_Store 65 | .DS_Store? 66 | ._* 67 | .Spotlight-V100 68 | .Trashes 69 | ehthumbs.db 70 | Thumbs.db 71 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | buildToolsVersion "30.0.1" 6 | defaultConfig { 7 | applicationId "eu.dkaratzas.android.inapp.update.sample" 8 | minSdkVersion 17 9 | targetSdkVersion 30 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | compileOptions { 21 | sourceCompatibility JavaVersion.VERSION_1_8 22 | targetCompatibility JavaVersion.VERSION_1_8 23 | } 24 | } 25 | 26 | dependencies { 27 | implementation project(':library') 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | implementation 'androidx.appcompat:appcompat:1.3.0' 30 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 31 | testImplementation 'junit:junit:4.13' 32 | androidTestImplementation 'androidx.test:runner:1.3.0' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 34 | implementation 'com.google.android.material:material:1.4.0-rc01' 35 | implementation 'com.jakewharton:butterknife:10.1.0' 36 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0' 37 | } 38 | -------------------------------------------------------------------------------- /docs/javadoc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes (library 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/javadoc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes (library 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /library/src/androidTest/java/eu/dkaratzas/android/inapp/update/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update; 18 | 19 | import android.content.Context; 20 | 21 | import androidx.test.InstrumentationRegistry; 22 | import androidx.test.runner.AndroidJUnit4; 23 | 24 | import org.junit.Test; 25 | import org.junit.runner.RunWith; 26 | 27 | import static org.junit.Assert.*; 28 | 29 | /** 30 | * Instrumented test, which will execute on an Android device. 31 | * 32 | * @see Testing documentation 33 | */ 34 | @RunWith(AndroidJUnit4.class) 35 | public class ExampleInstrumentedTest { 36 | @Test 37 | public void useAppContext() { 38 | // Context of the app under test. 39 | Context appContext = InstrumentationRegistry.getTargetContext(); 40 | 41 | assertEquals("eu.dkaratzas.android.inapp.update.test", appContext.getPackageName()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/androidTest/java/eu/dkaratzas/android/inapp/update/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update.sample; 18 | 19 | import android.content.Context; 20 | 21 | import androidx.test.InstrumentationRegistry; 22 | import androidx.test.runner.AndroidJUnit4; 23 | 24 | import org.junit.Test; 25 | import org.junit.runner.RunWith; 26 | 27 | import static org.junit.Assert.*; 28 | 29 | /** 30 | * Instrumented test, which will execute on an Android device. 31 | * 32 | * @see Testing documentation 33 | */ 34 | @RunWith(AndroidJUnit4.class) 35 | public class ExampleInstrumentedTest { 36 | @Test 37 | public void useAppContext() { 38 | // Context of the app under test. 39 | Context appContext = InstrumentationRegistry.getTargetContext(); 40 | 41 | assertEquals("eu.dkaratzas.android.inapp.update.sample", appContext.getPackageName()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docs/javadoc/eu/dkaratzas/android/inapp/update/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | eu.dkaratzas.android.inapp.update (library 1.0.1 API) 7 | 8 | 9 | 10 | 11 | 12 |

eu.dkaratzas.android.inapp.update

13 |
14 |

Interfaces

15 | 18 |

Classes

19 | 24 |

Enums

25 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /library/src/main/java/eu/dkaratzas/android/inapp/update/InAppUpdateStatus.java: -------------------------------------------------------------------------------- 1 | package eu.dkaratzas.android.inapp.update; 2 | 3 | import com.google.android.play.core.appupdate.AppUpdateInfo; 4 | import com.google.android.play.core.install.InstallState; 5 | import com.google.android.play.core.install.model.InstallStatus; 6 | import com.google.android.play.core.install.model.UpdateAvailability; 7 | 8 | /** 9 | * This class is just a wrapper for AppUpdateInfo and InstallState 10 | * Used by InAppUpdateManager 11 | */ 12 | public class InAppUpdateStatus { 13 | 14 | private static final int NO_UPDATE = 0; 15 | private AppUpdateInfo appUpdateInfo; 16 | private InstallState installState; 17 | 18 | public InAppUpdateStatus() { 19 | } 20 | 21 | public void setAppUpdateInfo(AppUpdateInfo appUpdateInfo) { 22 | this.appUpdateInfo = appUpdateInfo; 23 | } 24 | 25 | public void setInstallState(InstallState installState) { 26 | this.installState = installState; 27 | } 28 | 29 | public boolean isDownloading() { 30 | if (installState != null) 31 | return installState.installStatus() == InstallStatus.DOWNLOADING; 32 | 33 | return false; 34 | } 35 | 36 | public boolean isDownloaded() { 37 | if (installState != null) 38 | return installState.installStatus() == InstallStatus.DOWNLOADED; 39 | 40 | return false; 41 | } 42 | 43 | public boolean isFailed() { 44 | if (installState != null) 45 | return installState.installStatus() == InstallStatus.FAILED; 46 | 47 | return false; 48 | } 49 | 50 | public boolean isUpdateAvailable() { 51 | if (appUpdateInfo != null) 52 | return appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE; 53 | 54 | return false; 55 | } 56 | 57 | public int availableVersionCode() { 58 | if (appUpdateInfo != null) 59 | return appUpdateInfo.availableVersionCode(); 60 | 61 | return NO_UPDATE; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/java/eu/dkaratzas/android/inapp/update/sample/Immediate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update.sample; 18 | 19 | import android.app.Activity; 20 | import android.content.Intent; 21 | import android.os.Bundle; 22 | import android.util.Log; 23 | 24 | import androidx.annotation.Nullable; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import eu.dkaratzas.android.inapp.update.InAppUpdateManager; 28 | 29 | import static eu.dkaratzas.android.inapp.update.Constants.UpdateMode; 30 | 31 | public class Immediate extends AppCompatActivity { 32 | private static final int REQ_CODE_VERSION_UPDATE = 530; 33 | private static final String TAG = "Sample"; 34 | private InAppUpdateManager inAppUpdateManager; 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | setContentView(R.layout.activity_main); 40 | 41 | inAppUpdateManager = InAppUpdateManager.Builder(this, REQ_CODE_VERSION_UPDATE) 42 | .resumeUpdates(true) // Resume the update, if the update was stalled. Default is true 43 | .mode(UpdateMode.IMMEDIATE); 44 | 45 | inAppUpdateManager.checkForAppUpdate(); 46 | } 47 | 48 | @Override 49 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 50 | if (requestCode == REQ_CODE_VERSION_UPDATE) { 51 | if (resultCode == Activity.RESULT_CANCELED) { 52 | // If the update is cancelled by the user, 53 | // you can request to start the update again. 54 | inAppUpdateManager.checkForAppUpdate(); 55 | 56 | Log.d(TAG, "Update flow failed! Result code: " + resultCode); 57 | } 58 | } 59 | 60 | super.onActivityResult(requestCode, resultCode, data); 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /docs/javadoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | library 1.0.1 API 7 | 60 | 61 | 62 | 63 | 64 | 65 | <noscript> 66 | <div>JavaScript is disabled on your browser.</div> 67 | </noscript> 68 | <h2>Frame Alert</h2> 69 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="eu/dkaratzas/android/inapp/update/package-summary.html">Non-frame version</a>.</p> 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /app/src/main/java/eu/dkaratzas/android/inapp/update/sample/FlexibleDefaultSnackbar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dionysios Karatzas 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eu.dkaratzas.android.inapp.update.sample; 18 | 19 | import android.content.Intent; 20 | import android.os.Bundle; 21 | import android.util.Log; 22 | 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import eu.dkaratzas.android.inapp.update.InAppUpdateManager; 27 | import eu.dkaratzas.android.inapp.update.InAppUpdateStatus; 28 | 29 | import static eu.dkaratzas.android.inapp.update.Constants.UpdateMode; 30 | 31 | public class FlexibleDefaultSnackbar extends AppCompatActivity implements InAppUpdateManager.InAppUpdateHandler { 32 | private static final int REQ_CODE_VERSION_UPDATE = 530; 33 | private static final String TAG = "Sample"; 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_main); 39 | 40 | InAppUpdateManager inAppUpdateManager = InAppUpdateManager.Builder(this, REQ_CODE_VERSION_UPDATE) 41 | .resumeUpdates(true) // Resume the update, if the update was stalled. Default is true 42 | .mode(UpdateMode.FLEXIBLE) 43 | .useCustomNotification(false) //default is false 44 | .snackBarMessage("An update has just been downloaded.") 45 | .snackBarAction("RESTART") 46 | .handler(this); 47 | 48 | inAppUpdateManager.checkForAppUpdate(); 49 | } 50 | 51 | @Override 52 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 53 | if (requestCode == REQ_CODE_VERSION_UPDATE) { 54 | if (resultCode != RESULT_OK) { 55 | // If the update is cancelled or fails, 56 | // you can request to start the update again. 57 | Log.d(TAG, "Update flow failed! Result code: " + resultCode); 58 | } 59 | } 60 | 61 | super.onActivityResult(requestCode, resultCode, data); 62 | 63 | } 64 | 65 | // InAppUpdateHandler implementation 66 | 67 | @Override 68 | public void onInAppUpdateError(int code, Throwable error) { 69 | /* 70 | * Called when some error occurred. See Constants class for more details 71 | */ 72 | Log.d(TAG, "code: " + code, error); 73 | } 74 | 75 | @Override 76 | public void onInAppUpdateStatus(InAppUpdateStatus status) { 77 | /* 78 | * Called when the update status change occurred. See Constants class for more details 79 | */ 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /gradle/bintray.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | ext { 5 | bintrayRepo = 'maven' 6 | bintrayName = 'android-inapp-update' 7 | 8 | libraryName = 'library' 9 | publishedGroupId = 'eu.dkaratzas' 10 | artifact = 'android-inapp-update' 11 | 12 | libraryDescription = 'An implementation of Android In-app Update' 13 | 14 | siteUrl = 'https://github.com/dnKaratzas/android-inapp-update' 15 | gitUrl = 'https://github.com/dnKaratzas/android-inapp-update.git' 16 | 17 | libraryVersion = version 18 | 19 | developerId = 'dkaratzas' 20 | developerName = 'Dionysios Karatzas' 21 | developerEmail = 'dnkaratzas@gmail.com' 22 | 23 | licenseName = 'The Apache Software License, Version 2.0' 24 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 25 | allLicenses = ["Apache-2.0"] 26 | } 27 | 28 | group = publishedGroupId 29 | version = libraryVersion 30 | 31 | install { 32 | group = 'publishing' 33 | repositories.mavenInstaller { 34 | pom.project { 35 | packaging 'aar' 36 | groupId publishedGroupId 37 | artifactId artifact 38 | 39 | name libraryName 40 | description libraryDescription 41 | url siteUrl 42 | 43 | licenses { 44 | license { 45 | name licenseName 46 | url licenseUrl 47 | } 48 | } 49 | developers { 50 | developer { 51 | id developerId 52 | name developerName 53 | email developerEmail 54 | } 55 | } 56 | scm { 57 | connection gitUrl 58 | developerConnection gitUrl 59 | url siteUrl 60 | } 61 | } 62 | } 63 | } 64 | 65 | task sourcesJar(type: Jar) { 66 | classifier = 'sources' 67 | from android.sourceSets.main.java.srcDirs 68 | } 69 | 70 | task javadoc(type: Javadoc) { 71 | group = 'publishing' 72 | failOnError false 73 | source = android.sourceSets.main.java.sourceFiles 74 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 75 | classpath += configurations.compile 76 | destinationDir = file("${rootDir}/docs/javadoc") 77 | } 78 | 79 | task javadocJar(type: Jar, dependsOn: javadoc) { 80 | classifier = 'javadoc' 81 | from javadoc.destinationDir 82 | } 83 | 84 | artifacts { 85 | archives javadocJar 86 | archives sourcesJar 87 | } 88 | 89 | Properties properties = new Properties() 90 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 91 | 92 | bintray { 93 | user = properties.getProperty("bintray.user") 94 | key = properties.getProperty("bintray.apikey") 95 | 96 | configurations = ['archives'] 97 | pkg { 98 | repo = bintrayRepo 99 | name = bintrayName 100 | desc = libraryDescription 101 | websiteUrl = siteUrl 102 | vcsUrl = gitUrl 103 | licenses = allLicenses 104 | dryRun = false 105 | publish = true 106 | override = false 107 | publicDownloadNumbers = true 108 | version { 109 | desc = libraryDescription 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 19 | 20 | 29 | 30 | 40 | 41 | 49 | 50 | 56 | 57 | 58 | 59 |