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

Commit dd63ab7

Browse files
committed
Readme
1 parent 9138528 commit dd63ab7

4 files changed

Lines changed: 128 additions & 64 deletions

File tree

.idea/markdown-navigator.xml

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 0 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.MD

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Android Version Status Resolver and Fetcher
2+
3+
## Purpose of library
4+
Many applications have need to tell users to update current application because they have outdated version. Google Play doesnt support any API for that so we need to use custom solution - even some api request or service like Firebase Remote Configuration.
5+
6+
## Usage
7+
The simplest way for use this library is
8+
```java
9+
val versionFetcher = ...
10+
val versionHandler = new VersionHandler(versionFetcher)
11+
versionHandler.checkVersionStatusAndShowDefault(BuildConfig.VERSION_CODE, getSupportFragmentManager())
12+
```
13+
14+
this will check versions and show update dialog with the right settings.
15+
16+
If you want to show custom UI with update info, you can use different method:
17+
18+
```java
19+
val versionFetcher = ...
20+
val versionHandler = new VersionHandler(versionFetcher)
21+
22+
versionHandler.checkVersionStatus(BuildConfig.VERSION_CODE)
23+
.subscribe({ status ->
24+
if(status == UP_TO_DATE) {
25+
// app is up to date
26+
} else if(status == UPDATE_AVAILABLE) {
27+
// update is available but is not mandatory
28+
} else {
29+
// update is mandatory, user should not be able to run app
30+
}, {err ->
31+
// some error happened while fetching version info
32+
})
33+
34+
```
35+
VersionHandler class takes responsibility for deciding status of update based on fetched version info and current application version. It returns `Single<VersionStatus>`
36+
37+
Interface VersionFetcher should be used for actual fetching of version configurations.
38+
39+
Two basic implementation are provided in separate modules - Firebase Remote Config fetcher and Rest Api Fetcher
40+
41+
### Firebase Remote Config
42+
Class `FirebaseVersionFetcher` takes optional argument for cache expiration of fetched data from Firebase Remote Config. Default names of attributes are `minimal_version_android` and `current_version_android` but you can modify that with constructor attributes.
43+
```groovy
44+
compile "cz.ackee.versionfetcher:firebase-fetcher:x.x.x"
45+
```
46+
47+
48+
### Rest Api
49+
Class `RestVersionFetcher` accepts as argument base url of server. On url GET ${baseUrl}/app-version is expected response with attributes `minimal_version_android` and `current_version_android` (names can be also modified)
50+
```groovy
51+
compile "cz.ackee.versionfetcher:rest-fetcher:x.x.x"
52+
```
53+
## Dependencies
54+
55+
```groovy
56+
compile "cz.ackee.versionfetcher:status-resolver:x.x.x"
57+
```

0 commit comments

Comments
 (0)