Skip to content

Commit 847f5f7

Browse files
Adrián GarcíaDaniel Sánchez Ceinos
andauthored
Library upgrade to new play-core versions (#4)
* General library improvements * Add client version staleness. Rework views of example app to use viewBinding * Add update priority * Add download progress to install state * Add support for calling the helper in Fragments * Add new error types in the helper * Update README.md * Update build.gradle Co-authored-by: Daniel Sánchez Ceinos <[email protected]> Co-authored-by: Daniel Sánchez Ceinos <[email protected]>
1 parent 51e61cd commit 847f5f7

30 files changed

+1184
-246
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
---
22
name: Bug report
3-
about: Create a report to help us improve
3+
about: Create a bug report to help us improve
44
title: ''
55
labels: bug
66
assignees: adriangl
77

88
---
99

10-
**Device and SW details (please complete the following information):**
11-
- Device: [e.g. Google Pixel 3]
12-
- OS: [e.g. Android 9]
13-
- Library Version [e.g. 1.0.0]
10+
**Device and SW details**
11+
- Device: [e.g. Google Pixel 3]
12+
- OS: [e.g. Android 9]
13+
- Library Version [e.g. 1.0.0]
14+
15+
**Conditions for the library to work**
16+
- [ ] I have set the package name of the app to **exactly** the one I'd like to test in-app updates with.
17+
- [ ] I have signed the app with the same key that I used to sign the app I want to test in-app updates with.
18+
- [ ] I've ensured that any of my Google accounts in my test device has access to said app in Google Play Store.
19+
- [ ] The Google Play Store displays updates for the app I want to use to test in-app updates with.
1420

1521
**Summary and background of the bug**
1622
A clear and concise description of what the bug is.
1723

1824
**Steps to reproduce**
1925
Steps to reproduce the behavior:
2026
1. Go to '...'
21-
2. Click on '....'
22-
3. Scroll down to '....'
27+
2. Click on '...'
28+
3. Scroll down to '...'
2329
4. See error
2430

2531
Also attach notes or stack traces if applicable.

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ captures/
4040
.idea/dictionaries
4141
.idea/libraries
4242
.idea/caches
43-
.idea/codeStyles
4443
.idea/modules.xml
4544
.idea/misc.xml
4645
.idea/jarRepositories.xml
46+
.idea/vcs.xml
4747

4848
# Keystore files
4949
*.jks
@@ -57,4 +57,7 @@ google-services.json
5757
# Freeline
5858
freeline.py
5959
freeline/
60-
freeline_project_description.json
60+
freeline_project_description.json
61+
62+
# App configuration properties
63+
app_config.properties

.idea/codeStyles/Project.xml

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

.idea/compiler.xml

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

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,127 @@
33

44
This utility library aims to help Android developers to use the [Google Play In-App Updates API](https://developer.android.com/guide/app-bundle/in-app-updates) in an easy way.
55

6-
**It's highly encouraged that you first read the [Google Play In-App Updates API](https://developer.android.com/guide/app-bundle/in-app-updates) documentation before using this library in order to understand the core concepts of the library.**
6+
> It's highly encouraged that you first read the [Google Play In-App Updates API](https://developer.android.com/guide/app-bundle/in-app-updates) documentation before using this library in order to understand the core concepts of the library.
7+
8+
## Setting Up
9+
In your main `build.gradle`, add [jitpack.io](https://jitpack.io/) repository in the `allprojects` block:
10+
11+
<details open><summary>Groovy</summary>
712

8-
## Installation
9-
Add the following dependencies to your main `build.gradle`:
1013
```groovy
1114
allprojects {
1215
repositories {
1316
maven { url "https://jitpack.io" }
1417
}
1518
}
1619
```
20+
</details>
1721

18-
Add the following dependencies to your app's `build.gradle`:
22+
<details><summary>Kotlin</summary>
1923

20-
* For Gradle < 4.0
21-
```groovy
22-
dependencies {
23-
compile "com.github.bq:android-app-updates-helper:1.0.2"
24+
```kotlin
25+
allprojects {
26+
repositories {
27+
maven(url = "https://jitpack.io")
2428
}
25-
```
29+
}
30+
```
31+
</details>
32+
33+
34+
Add the following dependencies to your app or library's `build.gradle`:
35+
36+
<details open><summary>Groovy</summary>
37+
38+
```groovy
39+
dependencies {
40+
implementation "com.github.bq:android-app-updates-helper:1.0.2"
41+
}
42+
```
43+
</details>
44+
45+
46+
<details><summary>Kotlin</summary>
47+
48+
```kotlin
49+
dependencies {
50+
implementation("com.github.bq:android-app-updates-helper:1.0.2")
51+
}
52+
```
53+
</details>
2654

27-
* For Gradle 4.0+
28-
```groovy
29-
dependencies {
30-
implementation "com.github.bq:android-app-updates-helper:1.0.2"
55+
You'll also need to add support for Java 8 in your project. To do so:
56+
<details open><summary>Groovy</summary>
57+
58+
```groovy
59+
android {
60+
compileOptions {
61+
sourceCompatibility JavaVersion.VERSION_1_8
62+
targetCompatibility JavaVersion.VERSION_1_8
63+
}
64+
kotlinOptions {
65+
jvmTarget = "1.8"
3166
}
32-
```
67+
}
68+
```
69+
</details>
3370

34-
## Example usage
71+
<details><summary>Kotlin</summary>
72+
73+
```kotlin
74+
android {
75+
compileOptions {
76+
sourceCompatibility = JavaVersion.VERSION_1_8
77+
targetCompatibility = JavaVersion.VERSION_1_8
78+
}
79+
kotlinOptions {
80+
jvmTarget = "1.8"
81+
}
82+
}
83+
```
84+
</details>
85+
86+
## How to use
3587
* Create a new _AppUpdatesHelper_.
36-
* Start listening for app update changes with _AppUpdatesHelper.startListening()_, for example in _onCreate()_.
37-
* Stop listening for app update changes with _AppUpdatesHelper.stopListening()_ in _onDestroy()_.
88+
* Start listening for app update changes with _AppUpdatesHelper.startListening()_, for example in _Activity.onCreate()_ or in _Fragment.onViewCreated()_.
89+
* Stop listening for app update changes with _AppUpdatesHelper.stopListening()_ in _Activity.onDestroy()_ or in _Fragment.onDestroyView()_.
3890
* Request app update information with _AppUpdatesHelper.getAppUpdateInfo()_.
3991
* Request a flexible or immediate update with _AppUpdatesHelper.startFlexibleUpdate()_ or _AppUpdatesHelper.startImmediateUpdate()_
4092

4193
Check the [example app](app) for more implementation details about [flexible](app/src/main/kotlin/com/bq/appupdateshelper/flexible/FlexibleUpdateActivity.kt)
4294
and [immediate](app/src/main/kotlin/com/bq/appupdateshelper/immediate/ImmediateUpdateActivity.kt) updates.
4395

44-
If you use the example app, don't forget the following things when testing:
45-
* Change the package name of the example app to the one you'd like to test in-app updates with.
46-
* Sign the example app with the same keys that you used to sign the app you want to test in-app updates with.
47-
* If the app is not published yet, or you want to test with internal app sharing or closed tracks, ensure that any of your Google accounts in your device has access to said app in Google Play Store.
48-
4996
You can also use a [fake implementation](app/src/main/kotlin/com/bq/appupdateshelper/fake/FakeUpdateActivity.kt) to test in-app updates.
5097

98+
Keep in mind that you may not see in-app updates if these conditions don't match:
99+
* The package name of the app is **exactly** the one you'd like to test in-app updates with.
100+
* The app must be signed with the same keys that you used to sign the app you want to test in-app updates with.
101+
* If the app is not published yet or you want to test with internal app sharing or closed tracks,
102+
ensure that any of your Google accounts in your device has access to said app in Google Play Store.
103+
* Check if the Google Play Store displays updates for the app you want to use to test in-app updates.
104+
105+
Please ensure that all conditions apply when using this library in order to avoid unnecessary headaches.
106+
107+
### Using the example app
108+
In order to ease using the example app with the sample data of your own app,
109+
you can create an `app_config.properties` file in the root of the project with the following content:
110+
```properties
111+
applicationId=your.application.id
112+
keystorePath=/full/path/to/your/keystore/file
113+
keystorePwd=your_keystore_password
114+
keystoreAlias=your_keystore_alias
115+
keystoreAliasPwd=your_keystore_alias_password
116+
```
117+
118+
These values will be picked up by the compilation process of the example app
119+
and will set the application ID and signing configurations for you.
120+
51121
## Authors & Collaborators
52-
* [Adrián García](https://github.com/adriangl) - Author and maintainer
53-
* [Daniel Sánchez Ceinos](https://github.com/danielceinos) - Contributor
122+
* **[Adrián García](https://github.com/adriangl)** - *Author and maintainer*
123+
* **[Daniel Sánchez Ceinos](https://github.com/danielceinos)** - *Contributor*
54124

55125
## License
126+
This project is licensed under the Apache Software License, Version 2.0.
56127
```
57128
Copyright (C) 2019 BQ
58129

0 commit comments

Comments
 (0)