Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.hummatli:MAHAndroidUpdater:v1.1.7'
}
dependencies {
implementation("com.github.hummatli:MAHAndroidUpdater:v1.1.7")
}
<dependency>
<groupId>com.github.hummatli</groupId>
<artifactId>MAHAndroidUpdater</artifactId>
<version>v1.1.7</version>
</dependency>
libraryDependencies += "com.github.hummatli" % "MAHAndroidUpdater" % "v1.1.7"
:dependencies [[com.github.hummatli/MAHAndroidUpdater "v1.1.7"]]
AndroidAppUpdater is a free, open source, third party Android library for notifing update information to android apps installed on an android device. By its help, an old application is notified about update information from the Google Play Market.
Library has built with Kotlin language on Android Studio IDE and binaries have added to jcenter() maven repository.
You can check jCenter() download statistics on this link
There is a list of application using AndroidAppUpdater. It would be nice if see your app link there too. If you use this library and want to see your app in the start of the list please inform me or send a pull request.
<img src="https://raw.githubusercontent.com/hummatli/AndroidAppUpdater/master/imgs/green_star.png" width="20px"/> Don't forget to start the protect to support us
New Feature: "Info Resolver". Now you can get information from your own formatted servicePortuguese: azzarr , Thanks!Hindi: dalwadi2, Thanks!German: Ndam Njoya, Thanks!French: Zeldarck, Thanks!, Has changed sample apps to support French.Greek: Nikos Linakis, Thanks!.Download the demo app from this link - <a href="https://github.com/hummatli/AndroidAppUpdater/releases/download/v1.1.7/DemoApp_AndroidAppUpdater.apk">Demo App</a>. You can easly test the lib's functionality.
To provide update information to your app you need to implement service responding json data about application current state. Structure of the json data is as below.
You can provide http:// and https:// services. Library works both of them.
Json with sample data. Link to working sample
{
"is_run_mode":"true",
"name":"AndroidAppUpdater Sample",
"uri_current":"com.mobapphome.mahandroidupdater.sample",
"version_code_current":"2",
"version_code_min":"1",
"update_info":"On version 1.0 we added bla bla",
"update_date":"16/07/2016"
}
is_run_mode - service mode: if it's false modul will not react to service and will not show dialogsname - name of the belonging appuri_current - current package pathversion_code_current - current version code avilableversion_code_min - Minimum version code, which does not work normal and had to force to updateupdate_info - Update informationupdate_date - Update dateIf one of the variables would not be on json, then modul will not repond to service and act, Try to implement all data.
You can check you json validity with this jsonlint.com
There is interface called IUpdateInfoResolver by the help of it you can fetch your update information form own structed service. For example JSON API, XML,Raw text and so on. For this reason there is special init() method accepting this variable. This feature has added by @andrewpros.
You can call with the same way in Kotlin and Java. Library contains samples both in Kotlin and Java
Library components:
AAUpdaterDlg- In this situation dialog show to user to update or install newer version and lets to postpone the action to later time and use applicationAAUpdaterRestricterDlg - In this situation dialog urges user to update or install newer version and dont alow use older versionThe porpose of lib to show automatically these dialogs on application start if there are any need for it.
- AAUpdaterDlg opens on following situation.
uri_current value is different from app's installed package urlversion_code_current value is greater than app's installed version on device- AAUpdaterRestricterDlg opens on all situation AAUpdaterDlg opens and following situation.
version_code_min value is greater than app's installed version on deviceBut when you develop your apps UI and want to show these dialogs there are test modes also and you can open dialogs by calling methods relatively
AAUpdaterController.testUpdaterDlg(activity) - AAUpdaterDlgAAUpdaterController.testRestricterDlg(activity) - AAUpdaterRestricterDlgThe lib has compiled with the gradle 4.6.
1) To import library to you project add following lines to project's build.gradle file.
The last stable version is 1.3.3
repositories {
maven { url 'https://dl.bintray.com/hummatli/maven/' }
}
dependencies {
//The android-app-updater libary
implementation 'com.mobapphome.library:android-app-updater:1.3.3'
//These dependencies have been used in this lib so you need to include them acording to gradle 3.0 and upper
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'org.jsoup:jsoup:1.10.2'
}
2) On the start of your application call AAUpdaterController.init() method to initialize modul. For example: MainActivity's onCreate() method or in splash activity. Check http url is correct and points to your service on the web.
Code:
AAUpdaterController.init(activity,"http://highsoft.az/android-app-updater-sample.php")
3) When you quit app, you have to call AAUpdaterController.end() method to finalize modul. For example: MainActivity's onDestroy() method.
AAUpdaterController.end()
4) To customize AndroidAppUpdater dialog UI and overide colors set these values on your main projects color.xml file
<color name="android_app_upd_window_background_color">#FFFFFFFF</color>
<color name="android_app_upd_title_bar_color">#FF3F51B5</color>
<color name="android_app_upd_info_txt_color">#FF3F51B5</color>
<color name="android_app_upd_restricter_dlg_btn_pressed_color">#a33F51B5</color>
<color name="android_app_upd_restricter_dlg_btn_dark_state_color">#ff3F51B5</color>
<color name="android_app_upd_restricter_dlg_btn_light_state_color">#ffffffff</color>
<color name="android_app_upd_upd_dlg_btn_text_color">#ffFF4081</color>
5) Localization: Following languages is supporting by the lib - Supported Languages. To set localization to app use your own method or if it is static and don't change in program session you can just simply add LocaleUpdater.updateLocale(this, "your_lang"); in the start of your app. For examlpe LocaleUpdater.updateLocale(this, "ru");
6) To customize AndroidAppUpdater UI texts and overide them add these lines to main projects string.xml and set them values.
To help translators there prefixes on the name of strings
<!-- noun --> <string name="noun_android_app_upd_dlg_title">Update information</string>
<!-- Button texts-->
<string name="android_app_upd_dlg_btn_no_later_txt">Later</string>
<!--command verb--> <string name="cmnd_verb_android_app_upd_dlg_btn_no_close_txt">Close</string>
<!--command verb--> <string name="cmnd_verb_android_app_upd_dlg_btn_yes_update_txt">Update</string>
<!--command verb--> <string name="cmnd_verb_android_app_upd_dlg_btn_yes_install_txt">Install</string>
<string name="android_app_upd_dlg_btn_yes_open_new_txt">Open new version</string>
<!--command verb--> <string name="cmnd_verb_android_app_upd_dlg_btn_no_uninstall_old_txt">Uninstall old</string>
<!-- Info texts-->
<string name="android_app_upd_updater_info_install">Application has moved to new address. Please install newer version</string>
<string name="android_app_upd_updater_info_update">New version is available. Please update application</string>
<string name="android_app_upd_restricter_info_install">This is old version and does not operate. An application has moved to new address. \nPlease install newer version</string>
<string name="android_app_upd_restricter_info_update">This is old version and does not operate. Please update application</string>
<string name="android_app_upd_restricter_info_open_new_version">This is old version and does not operate. Please open new version</string>
<!-- Additional information-->
<string name="android_app_upd_internet_update_error">Check your internet connection</string>
<string name="android_app_upd_play_service_not_found">Install Google Play Services to update application</string>
<string name="android_app_upd_info_popup_text">\"AndroidAppUpdater\" library</string>
7) To customize Info button on the right - upper corner of dialogs. You can do it with help of AAUpdaterController.init() method. It has three version. init()This method well documented and you can see it when developing your app.
You can do followings with Info button:
8) As modul takes information from web servcie you need add INTERNET permission to main project.
<uses-permission android:name="android.permission.INTERNET" />
AndroidAppUpdater uses <a href="https://github.com/google/gson">Gson</a> and <a href="https://github.com/jhy/jsoup">Jsoup</a> libs. There for if you want to create your project with proguard you need to add proguard configuration to your proguard file. Look at Progurda File.
If you have any problem with setting and using library or want to ask question, please let me know. Create issue or write to <i><a href="mailto:settarxan@gmail.com">settarxan@gmail.com</a></i>. I will help.
<!--## Releases - Upgrade documentation See [releases](https://github.com/hummatli/AndroidAppUpdater/releases). Please,read release notes to migrate your app from old version to a newer.-->I am open to hear offers and opinions from you
Library now supports following languages
To help translator in context I have added prefixes to the start of the string names.
Be carefull when translating. Prefixes are following:
* < command verb (actions)> - These are commands verbs. Meaninaction on UI , dialogs
* < noun > - these are nouns not action (verb)
We need help to add new language localization support for libarary. If you have any hope to help us we were very happy and you can check following <i><a href="https://github.com/hummatli/AndroidAppUpdater/issues">GitHub Issues URL</a></i> to contribute. To contribute get <a href="https://github.com/hummatli/AndroidAppUpdater/blob/master/android-app-updater/src/main/res/values/strings.xml</a> file and translate to newer language. Place it on res/values-"spacific_lang"/string.xml
Please ping me or send a pull request if you would like to see your app in the start of the list.
Icon | Application | Icon | Application ------------ | ------------- | ------------- | ------------- [Your app] |ping me or send a pull request | <img src="https://lh3.googleusercontent.com/UhNXotmmhpK3eCV5XEeLSX555Tu_k-A9VgqrPK_4EWLJsJaCUugNVGEahafCrO45Lg=w300-rw" width="48" height="48" /> | Indian Railway PNRStatus IRCTC <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/millionaire_ru.png" width="48" height="48" /> | Миллионер - на Pусском | <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/millionaire_tr.png" width="48" height="48" /> | Milyoner - Türkçe <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/millionaire_en.png" width="48" height="48" /> | Millionaire - in English | <img src="https://lh3.ggpht.com/kfuLs-Ic0xR3SOFdjJ3FVeI0es2oXTCEt1T2y8tEVeYm7otSuSSBDlrpz4wXtIygf4k=w300-rw" width="48" height="48" /> | Məzənnə <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/mah_ads_sample_icon.png" width="48" height="48" /> | AppCrossPromoter - Sample | <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/mah_android_updater_sample_icon.png" width="48" height="48" /> | AndroidAppUpdater - Sample <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/mah_encryptor_lib_sample_icon.png" width="48" height="48" /> | SimpleEncryptorLib - Sample | <img src="https://lh5.ggpht.com/P_TyFmB5BzYDGWl3yliDHkQr_ttrYzHS3yQk3mBS3QuJJ5TJZ1pMj8lx-wmUmAHiUw=w300-rw" width="48" height="48" /> | Ləzzət <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/millionaire_az.png" width="48" height="48" /> | Milyonçu | <img src="https://project-943403214286171762.firebaseapp.com/imgs_for_github_readmes/millionaire_de.png" width="48" height="48" />| Millionär - Deutsche
Copyright 2017 - <a href="https://www.linkedin.com/in/hummatli">Sattar Hummatli</a>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.