[
✔
] Android Get version from android stores(only support GooglePlay、XiaoMi、Tencent)
[
✔
] Android Jump to store mode upgrade
[
✔
] Android Download APK using download link
[
✔
] Monitor download information
[
✔
] cancel/pause/continue download
[
✔
] Get download status according to ID
[
✔
] Install app according to ID
[
✔
] Get the last download ID (based on the version name and version number)
[
✔
] Modify the information displayed in the notification bar
[
✔
] Android hot upgrade
[
✔
] Android increment upgrade
[
✔
] IOS Jump to Appstore upgrade according to appid
[
✔
] IOS Get the current online version of Appstore according to appid
For the development of this plug-in, I haven't had a good meal for a long time. I hope you can click on the sponsor and give a little bit of money. Thank you!
download status STATUS_PAUSED STATUS_PENDING STATUS_RUNNING STATUS_SUCCESSFUL STATUS_FAILED STATUS_CANCEL
2. Upgrade your application
This upgrade have two part. useDownloadManager:
true: Use system DownloadManagerto download
advantage:Simple, use system.
Inferiority:can not use http download , can not click the notification pause downloading, can not pause and continue download by network status etc...
support: RUpgrade.stream、install、cancel
false: Use Service download(default use)
advantage:Power, support http/https download, support auto pause and continue download by network status etc..
Inferiority:No bugs found yet. If you find a bug, you are welcome to issue
support: RUpgrade.stream、install、cancel
// [isAutoRequestInstall] downloaded finish will auto request install apk.// [apkName] apk name (such as `release.apk`)// [notificationVisibility] notification visibility.// [notificationStyle] download notification show style about content text, only support [useDownloadManager]==false.// [useDownloadManager] if true will use DownloadManager,false will use my service ,// if true will no use [pause] , [upgradeWithId] , [getDownloadStatus] , [getLastUpgradedId] methods.// [upgradeFlavor] you can use [RUpgradeFlavor.normal] , [RUpgradeFlavor.hotUpgrade] , [RUpgradeFlavor.incrementUpgrade] flavorvoidupgrade() async {
int id =awaitRUpgrade.upgrade(
'https://raw.githubusercontent.com/rhymelph/r_upgrade/master/apk/app-release.apk',
apkName:'app-release.apk',isAutoRequestInstall:true);
}
New upgraded flavor:(no support use DownloadManager)
enumRUpgradeFlavor {
normal, // full upgrade
hotUpgrade, // hot upgrade
incrementUpgrade, // increment upgrade
}
voidpause() async {
bool isSuccess=awaitRUpgrade.upgradeWithId(id);
/// return true. /// * if download status is [STATUS_PAUSED] or [STATUS_FAILED] or [STATUS_CANCEL], will restart running. /// * if download status is [STATUS_RUNNING] or [STATUS_PENDING], nothing happened. /// * if download status is [STATUS_SUCCESSFUL] , will install apk. /// /// return false. /// * if not found the id , will return [false].
}
7. Get the last upgrade id
voidgetLastUpgradeId() async {
int id =awaitRUpgrade.getLastUpgradedId();
}
8. Get the download status from id
voidgetDownloadStatus()async{
DownloadStatus status =awaitRUpgrade.getDownloadStatus(id);
}
you can use this id to hot upgrade,but download file is zip. include three file [isolate_snapshot_data]、[kernel_blob.bin]、[vm_snapshot_data].Your can use flutter build bundle generate.
flutter build bundle
generate file path form ./build/flutter_assets and packaged into zip.
use RUpgrade.upgrade(...,upgradeFlavor:RUpgradeFlavor.hotUpgrade)download file.
download complete you can use download id to hot upgrade
bool isSuccess =awaitRUpgrade.install(id);
if (isSuccess) {
_state.currentState
.showSnackBar(SnackBar(content:Text('Hot update succeeded, exit the application after 3S, please enter again')));
Future.delayed(Duration(seconds:3)).then((_){
SystemNavigator.pop(animated:true);
});
}else{
_state.currentState
.showSnackBar(SnackBar(content:Text('Hot update failed, please wait for update package download to complete')));
}
At present, the hot update is still in the testing stage, only supporting the change of the flutter code, not supporting the resource file, etc. the author of the plug-in is not responsible for all the consequences caused by the hot update, and the user is responsible for it.
Android Platform Notification Bar
If you want to customize the content displayed in the download notification bar, you can do so, modify or add files project/android/app/main/res/values/r_upgrade_value.xml,add the following code
Copyright 2021 rhymelph
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.
Hello,
It's great to have r_upgrade rich APIs on APP upgrading. It's the best solution I found.
But it's pity we have to remove it before since there's security issue on unsafe implementation of the X509TrustManager interface with the Apache HTTP client during Google Store's reviewing.
More information will be provided as below. May I know whether you will fix this issue ? Thanks !
"Your application has a security issue because it uses a potentially unsafe implementation of the X509TrustManager interface with the Apache HTTP client. For more information and the date by which the vulnerability should be addressed, see this Google Help Center article.
Classes with vulnerabilities:
• com.example.r_upgrade.common.UpgradeService$b
2、错误的信息为:
Activity com.xxx.MainActivity has leaked IntentReceiver com.example.r_upgrade.common.UpgradeManager$3@ba42023 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread(18075): android.app.IntentReceiverLeaked: Activity com.xxx.MainActivity
has leaked IntentReceiver com.example.r_upgrade.common.UpgradeManager$3@ba42023 that was originally registered here.
Are you missing a call to unregisterReceiver()?
Hi,
Appreciated for your working on r_upgrade and it's really helpful !
Full of features but I have only 1 question maybe I'm wrong since I'm new to APP world.
It's good to have getVersionFromAppStore to notify users new version on Apple Store.
Is there any API for Google Store ?
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.Timer.cancel()' on a null object reference
at com.example.r_upgrade.common.UpgradeManager$3.onReceive(UpgradeManager.java:314)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
FLAG_IMMUTABLE is missing for PendingIntent in UpgradeNotification.java:
E/AndroidRuntime(11658): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.r_upgrade.DOWNLOAD_STATUS flg=0x10 (has extras) } in com.example.r_upgrade.common.UpgradeManager$3@7fc8eed
E/AndroidRuntime(11658): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1689)
E/AndroidRuntime(11658): at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)
E/AndroidRuntime(11658): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(11658): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(11658): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(11658): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(11658): at android.app.ActivityThread.main(ActivityThread.java:7838)
E/AndroidRuntime(11658): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(11658): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(11658): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/AndroidRuntime(11658): Caused by: java.lang.IllegalArgumentException: [...]: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
W/System.err(15383): java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.pm.PackageInfo.packageName' on a null object reference
W/System.err(15383): at android.os.Parcel.readException(Parcel.java:1948)
W/System.err(15383): at android.os.Parcel.readException(Parcel.java:1888)
W/System.err(15383): at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4430)
W/System.err(15383): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1618)
W/System.err(15383): at android.app.Activity.startActivityForResult(Activity.java:4516)
W/System.err(15383): at android.app.Activity.startActivityForResult(Activity.java:4474)
W/System.err(15383): at android.app.Activity.startActivity(Activity.java:4835)
W/System.err(15383): at android.app.Activity.startActivity(Activity.java:4803)
2
W/System.err(15383): at android.content.ContextWrapper.startActivity(ContextWrapper.java:366)
W/System.err(15383): at com.example.r_upgrade.common.install.NormalInstallFactory.install(NormalInstallFactory.java:29)
W/System.err(15383): at com.example.r_upgrade.common.tasks.GenerateAndInstallByPathAsyncTask.installApk(GenerateAndInstallByPathAsyncTask.java:108)
W/System.err(15383): at com.example.r_upgrade.common.tasks.GenerateAndInstallByPathAsyncTask.onPostExecute(GenerateAndInstallByPathAsyncTask.java:87)
E/AndroidRuntime(32134): FATAL EXCEPTION: main
E/AndroidRuntime(32134): Process: com.aifitness.gymbot.phone, PID: 32134
E/AndroidRuntime(32134): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.r_upgrade.RECEIVER_CANCEL flg=0x10 (has extras) } in com.example.r_upgrade.common.UpgradeService$1@f86b8cb
E/AndroidRuntime(32134): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1708)
E/AndroidRuntime(32134): at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)
E/AndroidRuntime(32134): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(32134): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(32134): at android.os.Looper.loopOnce(Looper.java:210)
E/AndroidRuntime(32134): at android.os.Looper.loop(Looper.java:299)
E/AndroidRuntime(32134): at android.app.ActivityThread.main(ActivityThread.java:8227)
E/AndroidRuntime(32134): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32134): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/AndroidRuntime(32134): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
E/AndroidRuntime(32134): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.Timer.cancel()' on a null object reference
E/AndroidRuntime(32134): at com.example.r_upgrade.common.UpgradeService$UpgradeRunnable.cancel(UpgradeService.java:235)
E/AndroidRuntime(32134): at com.example.r_upgrade.common.UpgradeService$UpgradeRunnable.access$100(UpgradeService.java:200)
E/AndroidRuntime(32134): at com.example.r_upgrade.common.UpgradeService$1.onReceive(UpgradeService.java:79)
E/AndroidRuntime(32134): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1694)
E/AndroidRuntime(32134): ... 9 more
Flutter Download Manager is a Cross-Platform file downloader with Parallel and Batch Download support. Manage download tasks by url and be notified of status and their progress. Pause, Cancel, Queue and Resume Downloads.