cordova-plugin-in-app-updates 1.0.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -18
- package/nbproject/project.xml +1 -1
- package/package.json +12 -7
- package/plugin.xml +14 -14
- package/src/android/InAppUpdate.java +2 -5
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
  [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G33QACCVKYD7U)
|
|
1
|
+
      
|
|
3
2
|
|
|
4
3
|
# cordova-plugin-in-app-updates
|
|
5
4
|
|
|
@@ -8,12 +7,12 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
|
|
|
8
7
|
# Platforms
|
|
9
8
|
|
|
10
9
|
- Android
|
|
11
|
-
- Browser
|
|
10
|
+
- Browser (filler platform)
|
|
12
11
|
|
|
13
12
|
# Features
|
|
14
13
|
|
|
15
|
-
- AndroidX ready (plugin version 2.
|
|
16
|
-
-
|
|
14
|
+
- AndroidX ready (plugin version 2.x.x)
|
|
15
|
+
- Check for updates
|
|
17
16
|
- Install flexible updates
|
|
18
17
|
- Install immediate updates
|
|
19
18
|
- Customize snackbar message and button for Flexible updates
|
|
@@ -21,23 +20,24 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
|
|
|
21
20
|
|
|
22
21
|
# Installation
|
|
23
22
|
|
|
24
|
-
##
|
|
23
|
+
## Plugin Versions
|
|
25
24
|
|
|
26
|
-
| Plugin version | Cordova
|
|
27
|
-
| --- | --- | --- | --- |
|
|
28
|
-
| 1.0.6 | 9.0.0 | 8.0.0 | No |
|
|
29
|
-
| 2.0.5 | 10.0.0 | 9.0.0 | Yes |
|
|
25
|
+
| Plugin version | Cordova >= | Cordova Android | AndroidX | targetSdkVersion |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| 1.0.6 | 9.0.0 | 8.0.0 | No | 29 |
|
|
28
|
+
| 2.0.5 | 10.0.0 | 9.0.0 | Yes | 30/31 |
|
|
29
|
+
| 2.1.0 | 10.0.0 | 11.0.0 | Yes | 32 |
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### Install latest version from NPM
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
cordova plugin add cordova-plugin-in-app-updates
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### Install latest version from master
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
cordova plugin add cordova-plugin-in-app-updates
|
|
40
|
+
cordova plugin add https://github.com/andreszs/cordova-plugin-in-app-updates
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
# Methods
|
|
@@ -46,6 +46,10 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
|
|
|
46
46
|
|
|
47
47
|
Invokes the AppUpdateManager and return one of the [updateAvailability](https://developer.android.com/reference/com/google/android/play/core/install/model/UpdateAvailability.html) codes as string.
|
|
48
48
|
|
|
49
|
+
```javascript
|
|
50
|
+
cordova.plugins.InAppUpdate.getUpdateAvailability(successCallback, errorCallback)
|
|
51
|
+
```
|
|
52
|
+
|
|
49
53
|
### Return values
|
|
50
54
|
|
|
51
55
|
- **UPDATE_AVAILABLE**
|
|
@@ -53,6 +57,8 @@ Invokes the AppUpdateManager and return one of the [updateAvailability](https://
|
|
|
53
57
|
- **DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS**
|
|
54
58
|
- **UNKNOWN**
|
|
55
59
|
|
|
60
|
+
:information_source: Browser platform does nothing and always returns **UPDATE_NOT_AVAILABLE**
|
|
61
|
+
|
|
56
62
|
When this method returns **UPDATE_AVAILABLE**, your app is ready to use the following methods to prompt the user for update.
|
|
57
63
|
|
|
58
64
|
### Example
|
|
@@ -71,6 +77,10 @@ cordova.plugins.InAppUpdate.getUpdateAvailability(onSuccess, onFailure);
|
|
|
71
77
|
|
|
72
78
|
Starts a [flexible update](https://developer.android.com/guide/playcore/in-app-updates/kotlin-java#flexible "flexible update") process and prompts the user with a dialog to download the new version now or when Wi-Fi is available.
|
|
73
79
|
|
|
80
|
+
```javascript
|
|
81
|
+
cordova.plugins.InAppUpdate.updateFlexible(successCallback, errorCallback)
|
|
82
|
+
```
|
|
83
|
+
|
|
74
84
|
:warning: The **successCallback** from this method can be triggered repeatedly according to its status.
|
|
75
85
|
|
|
76
86
|
### Return values
|
|
@@ -85,6 +95,8 @@ Starts a [flexible update](https://developer.android.com/guide/playcore/in-app-u
|
|
|
85
95
|
- **DOWNLOADING**: An update is currently being downloaded in the background.
|
|
86
96
|
- **DOWNLOADED**: The update was downloaded and the snackbar with RESTART button has been shown.
|
|
87
97
|
|
|
98
|
+
:information_source: Browser platform does nothing and always returns **UPDATE_NOT_AVAILABLE**
|
|
99
|
+
|
|
88
100
|
### Example
|
|
89
101
|
|
|
90
102
|
```javascript
|
|
@@ -103,6 +115,10 @@ cordova.plugins.InAppUpdate.updateFlexible(onSuccess, onFailure);
|
|
|
103
115
|
|
|
104
116
|
Starts an [immediate update](https://developer.android.com/guide/playcore/in-app-updates/kotlin-java#immediate "immediate update") process and prompts the user with a fullscreen dialog to download now or when Wi-Fi is available. The update is downloaded and installed in the foreground, preventing the user from interacting with your app until the installation succeeds and the app is automatically restarted.
|
|
105
117
|
|
|
118
|
+
```javascript
|
|
119
|
+
cordova.plugins.InAppUpdate.updateImmediate(successCallback, errorCallback)
|
|
120
|
+
```
|
|
121
|
+
|
|
106
122
|
:warning: The **successCallback** from this method can be triggered repeatedly according to its status.
|
|
107
123
|
|
|
108
124
|
### Return values
|
|
@@ -116,6 +132,8 @@ Starts an [immediate update](https://developer.android.com/guide/playcore/in-app
|
|
|
116
132
|
- **DOWNLOADING**: An update is currently being downloaded in the foreground.
|
|
117
133
|
- **DOWNLOADED**: The update was downloaded and will be installed immediately.
|
|
118
134
|
|
|
135
|
+
:information_source: Browser platform does nothing and always returns **UPDATE_NOT_AVAILABLE**
|
|
136
|
+
|
|
119
137
|
### Example
|
|
120
138
|
|
|
121
139
|
```javascript
|
|
@@ -132,7 +150,11 @@ cordova.plugins.InAppUpdate.updateImmediate(onSuccess, onFailure);
|
|
|
132
150
|
|
|
133
151
|
Sets the label and the button text for the snackbar shown after downloading a flexible update. You are free to call this method at any time. You can also call it again to show different snackbar messages after the snackbar was shown.
|
|
134
152
|
|
|
135
|
-
|
|
153
|
+
```javascript
|
|
154
|
+
cordova.plugins.InAppUpdate.setSnackbarOptions(successCallback, errorCallback, snackbarText, snackbarButton, snackbarButtonColor)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
:information_source: Browser platform does nothing and always returns **SUCCESS**
|
|
136
158
|
|
|
137
159
|
### Example
|
|
138
160
|
|
|
@@ -149,7 +171,9 @@ var snackbarButtonColor = "#76FF03";
|
|
|
149
171
|
cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarText, snackbarButton, snackbarButtonColor);
|
|
150
172
|
```
|
|
151
173
|
|
|
152
|
-
###
|
|
174
|
+
### Snackbar default values
|
|
175
|
+
|
|
176
|
+
If this method is not called, default messages in English will be shown as follows.
|
|
153
177
|
|
|
154
178
|
- **snackbarText** = "An update has just been downloaded."
|
|
155
179
|
- **snackbarButton** = "RESTART"
|
|
@@ -162,8 +186,27 @@ cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarTex
|
|
|
162
186
|
|
|
163
187
|
# Plugin demo app
|
|
164
188
|
|
|
165
|
-
|
|
189
|
+
- [Compiled APK and reference](https://www.andreszsogon.com/cordova-in-app-update-plugin-demo-app/) including testing procedure instructions
|
|
190
|
+
- [Latest demo app version in Play Store](https://play.google.com/store/apps/details?id=com.andreszs.inappupdate.demo)
|
|
191
|
+
- [Source code for www folder](https://github.com/andreszs/cordova-plugin-demos)
|
|
192
|
+
|
|
193
|
+
<img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_1.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_2.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_3.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_4.jpg?raw=true" width="200" />
|
|
194
|
+
|
|
195
|
+
# Changelog
|
|
196
|
+
|
|
197
|
+
### 2.1.0
|
|
198
|
+
|
|
199
|
+
- Optimized for android-compileSdkVersion 32
|
|
200
|
+
- Minimum cordova-android version set to 11
|
|
201
|
+
- Replaced com.google.android.play:core with the standalone [Play In-App Updates Library](https://developer.android.com/reference/com/google/android/play/core/release-notes-in_app_updates "Play In-App Updates Library") 2.1.0
|
|
202
|
+
- Updated androidx.appcompat:appcompat to 1.5.1
|
|
203
|
+
- Updated com.google.android.material:material to 1.3.0
|
|
204
|
+
- Removed the `edit-config` rule that was setting `android:theme="@style/Theme.AppCompat.NoActionBar"`
|
|
205
|
+
- Tested on Android 5.1, 8.1, 10.
|
|
166
206
|
|
|
167
|
-
|
|
207
|
+
### 2.0.5
|
|
168
208
|
|
|
169
|
-
|
|
209
|
+
- Optimized for android-compileSdkVersion 30
|
|
210
|
+
- Updated androidx.appcompat:appcompat to 1.3.0
|
|
211
|
+
- Updated com.google.android.play:core to 1.8.0
|
|
212
|
+
- Updated com.google.android.material:material to 1.2.0
|
package/nbproject/project.xml
CHANGED
package/package.json
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-in-app-updates",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "In-App updates from Play Store for your Apache Cordova app.",
|
|
5
5
|
"cordova": {
|
|
6
|
-
"id": "cordova-plugin-in-app-
|
|
6
|
+
"id": "cordova-plugin-in-app-update",
|
|
7
7
|
"platforms": [
|
|
8
|
-
"android"
|
|
8
|
+
"android",
|
|
9
|
+
"browser"
|
|
9
10
|
]
|
|
10
11
|
},
|
|
11
12
|
"engines": {
|
|
12
13
|
"cordovaDependencies": {
|
|
13
|
-
"1.0
|
|
14
|
-
"cordova": ">=
|
|
15
|
-
"cordova-android": ">=
|
|
14
|
+
"2.1.0": {
|
|
15
|
+
"cordova": ">=10.0.0",
|
|
16
|
+
"cordova-android": ">=11.0.0"
|
|
16
17
|
},
|
|
17
18
|
"2.0.5": {
|
|
18
19
|
"cordova": ">=10.0.0",
|
|
19
|
-
"cordova-android": ">=
|
|
20
|
+
"cordova-android": ">=10.0.0"
|
|
21
|
+
},
|
|
22
|
+
"1.0.6": {
|
|
23
|
+
"cordova": ">=9.0.0",
|
|
24
|
+
"cordova-android": ">=8.0.0"
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
},
|
package/plugin.xml
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-in-app-updates" version="1.0
|
|
2
|
+
<plugin id="cordova-plugin-in-app-updates" version="2.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>InAppUpdate</name>
|
|
4
4
|
<description>In-App updates from Play Store for your Apache Cordova app.</description>
|
|
5
5
|
<license>MIT</license>
|
|
6
6
|
<keywords>android,in-app,update</keywords>
|
|
7
7
|
|
|
8
8
|
<engines>
|
|
9
|
-
<engine name="cordova" version=">=
|
|
10
|
-
<engine name="cordova-android" version=">=
|
|
9
|
+
<engine name="cordova" version=">=10.0.0" />
|
|
10
|
+
<engine name="cordova-android" version=">=11.0.0" />
|
|
11
11
|
</engines>
|
|
12
12
|
|
|
13
13
|
<js-module name="InAppUpdate" src="www/InAppUpdate.js">
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
</js-module>
|
|
16
16
|
|
|
17
17
|
<platform name="android">
|
|
18
|
-
<
|
|
19
|
-
|
|
18
|
+
<config-file target="config.xml" parent="/*">
|
|
19
|
+
<preference name="AndroidXEnabled" value="true" />
|
|
20
|
+
</config-file>
|
|
20
21
|
|
|
21
|
-
<preference name="
|
|
22
|
-
<framework src="
|
|
22
|
+
<preference name="ANDROIDX_APPCOMPAT_VERSION" default="1.5.1" />
|
|
23
|
+
<framework src="androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION" />
|
|
24
|
+
|
|
25
|
+
<preference name="ANDROID_PLAY_APP_UPDATE_VERSION" default="2.1.0" />
|
|
26
|
+
<framework src="com.google.android.play:app-update:$ANDROID_PLAY_APP_UPDATE_VERSION" />
|
|
23
27
|
|
|
24
|
-
<preference name="
|
|
25
|
-
<framework src="com.android.
|
|
28
|
+
<preference name="ANDROID_MATERIAL_VERSION" default="1.3.0" />
|
|
29
|
+
<framework src="com.google.android.material:material:$ANDROID_MATERIAL_VERSION" />
|
|
26
30
|
|
|
27
31
|
<config-file target="res/xml/config.xml" parent="/*">
|
|
28
32
|
<feature name="InAppUpdate">
|
|
29
33
|
<param name="android-package" value="com.andreszs.inappupdate.InAppUpdate" />
|
|
30
34
|
</feature>
|
|
31
35
|
</config-file>
|
|
32
|
-
|
|
33
|
-
<edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="merge">
|
|
34
|
-
<activity android:name="MainActivity" android:theme="@style/Theme.AppCompat.NoActionBar" />
|
|
35
|
-
</edit-config>
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
<source-file src="src/android/InAppUpdate.java" target-dir="src/com/andreszs/inappupdate" />
|
|
38
38
|
</platform>
|
|
39
39
|
|
|
@@ -4,7 +4,7 @@ import android.app.Activity;
|
|
|
4
4
|
import android.content.Intent;
|
|
5
5
|
import android.content.IntentSender;
|
|
6
6
|
import android.graphics.Color;
|
|
7
|
-
import android.
|
|
7
|
+
import com.google.android.material.snackbar.Snackbar;
|
|
8
8
|
import android.util.Log;
|
|
9
9
|
import android.view.View;
|
|
10
10
|
import android.widget.FrameLayout;
|
|
@@ -19,7 +19,7 @@ import com.google.android.play.core.install.model.UpdateAvailability;
|
|
|
19
19
|
import com.google.android.play.core.install.model.InstallStatus;
|
|
20
20
|
import com.google.android.play.core.install.InstallState;
|
|
21
21
|
import com.google.android.play.core.install.InstallStateUpdatedListener;
|
|
22
|
-
import com.google.android.
|
|
22
|
+
import com.google.android.gms.tasks.Task;
|
|
23
23
|
|
|
24
24
|
import org.apache.cordova.CallbackContext;
|
|
25
25
|
import org.apache.cordova.CordovaInterface;
|
|
@@ -35,9 +35,6 @@ import static android.app.Activity.RESULT_CANCELED;
|
|
|
35
35
|
import static android.app.Activity.RESULT_OK;
|
|
36
36
|
import static com.google.android.play.core.install.model.ActivityResult.RESULT_IN_APP_UPDATE_FAILED;
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* @author https://github.com/andreszs/cordova-plugin-in-app-update
|
|
40
|
-
*/
|
|
41
38
|
public class InAppUpdate extends CordovaPlugin {
|
|
42
39
|
|
|
43
40
|
private static String LOG_TAG;
|