🆙🚀 Flutter application upgrade/ Flutter App Upgrade /Flutter App Update/Flutter Update / download Plug-in

Overview

r_upgrade

pub package

中文点此

Android and IOS upgrade plugin.

  • [] Jump link mode upgrade
  • [] Android Get user installed android stores.
  • [] 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!

List

Getting Started

1. Use Plugin:

add this code in pubspec.yaml

dependencies:
  r_upgrade: last version

2. Upgrade from your website ( Android or IOS )

    void upgradeFromUrl()async{
        bool isSuccess =await RUpgrade.upgradeFromUrl(
                    'https://www.google.com',
                  );
        print(isSuccess);
    }

Android Platform

1.Get android store list.

    void getAndroidStores() async {
       final stores = await RUpgrade.androidStores;
    }

2.Get version from android store.

    void getVersionName() async {
       final versionName = await RUpgrade.getVersionFromAndroidStore(AndroidStore.GOOGLE_PLAY);
    }

3. App upgrade from store.

    void upgradeFromAndroidStore(){
       bool isSuccess = await RUpgrade.upgradeFromAndroidStore(AndroidStore.GOOGLE_PLAY);
       print('${isSuccess?'jump success':'jump error'}');
    }

4. App upgrade from download link.

make sure your application had this permission and request dynamic permission.

">
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

1. Add Upgrade Download Listener

RUpgrade.stream.listen((DownloadInfo info){
  ///...
});

info:

param desc
(int) id download id
(int) max_length download max bytes length (bytes)
(int) current_length download current bytes length (bytes)
(double) percent download percent 0-100
(double) planTime download plan time /s (X.toStringAsFixed(0))
(String) path download file path
(double) speed download speed kb/s
(DownloadStatus) status 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.streaminstallcancel
  • 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.streaminstallcancel
    // [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] flavor
    void upgrade() async {
      int id = await RUpgrade.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)

enum RUpgradeFlavor {
  normal, // full upgrade
  hotUpgrade, // hot upgrade
  incrementUpgrade, // increment upgrade
}

3. Cancel Download

    void cancel() async {
      bool isSuccess=await RUpgrade.cancel(id);
    }

4. Install Apk

  • use download id install
    void install() async {
      bool isSuccess=await RUpgrade.install(id);
    }
  • use file path install
    void installByPath(String path) async {
      bool isSuccess=await RUpgrade.installByPath(path);
     }

5. Pause Download

    void pause() async {
      bool isSuccess=await RUpgrade.pause(id);
    }

6. Continue Download

    void pause() async {
      bool isSuccess=await RUpgrade.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

    void getLastUpgradeId() async {
     int id = await RUpgrade.getLastUpgradedId();
    }

8. Get the download status from id

    void getDownloadStatus()async{
    DownloadStatus status = await RUpgrade.getDownloadStatus(id);
   }

9. Increment Upgrade

  • 1.Download bsdiff to local.
  • 2.Prepare two installation packages, one is the one to be upgraded( old.apk ), an installation package that you need to update( new.apk )
  • 3.Switch to the 'bsdiff' directory downloaded above on the command line, and run the command./bsdiff old.apk new.apk increment.patch
  • 4.Put theincrement.patchUpload to server
  • 5.use RUpgrade.upgrade(...,upgradeFlavor:RUpgradeFlavor.incrementUpgrade)download file
  • 6.use RUpgrade.install(id) install apk.

The code is as follows:

    int id;
    void incrementUpgrade(){
        id = await RUpgrade.upgrade(
                'https://mydata-1252536312.cos.ap-guangzhou.myqcloud.com/r_upgrade.patch',
                fileName: 'r_upgrade.patch',
                useDownloadManager: false,
                isAutoRequestInstall: false,
                upgradeFlavor: RUpgradeFlavor.incrementUpgrade,
              );
    }

    void install(){
        try {
            await RUpgrade.install(id);
        } catch (e) {
            _state.currentState
                .showSnackBar(SnackBar(content: Text('failure!')));
        }
    }

10. Hot Upgrade

  • 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.
|- AssetManifest.json
|- FontManifest.json
|- fonts
    |- ...
|- isolate_snapshot_data *
|- kernel-blob.bin       *
|- LICENSE
|- packages
    |- ...
|- vm_snapshot_data      *
  • use RUpgrade.upgrade(...,upgradeFlavor:RUpgradeFlavor.hotUpgrade)download file.
  • download complete you can use download id to hot upgrade
          bool isSuccess = await RUpgrade.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

%.0f kb/s %.0fs left Download finished Download paused Download failed ">
xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="r_upgrade_download_speech">%.0f kb/sstring>
    <string name="r_upgrade_download_planTime">%.0fs leftstring>
    <string name="r_upgrade_download_finish">Download finishedstring>
    <string name="r_upgrade_download_paused">Download pausedstring>
    <string name="r_upgrade_download_failed">Download failedstring>
resources>

And then.When you use upgrade method,you should set the notificationStyle param.

/// Notification show style about content text
enum NotificationStyle {
  speechAndPlanTime, // 100kb/s 1s left
  planTimeAndSpeech, // 1s left 100kb/s
  speech,// 100kb/s
  planTime, // 1s left
  none, //
}

IOS Platform

1.Go to the AppStore Upgrade

    void upgradeFromAppStore() async {
        bool isSuccess =await RUpgrade.upgradeFromAppStore(
                 'your AppId',//such as:WeChat AppId:414478124
                 false
              );
        print(isSuccess);
    }

2.Get the last version form AppStore

    void getVersionFromAppStore() async {
        String versionName = await RUpgrade.getVersionFromAppStore(
                'your AppId',//such as:WeChat AppId:414478124
                false
               );
        print(versionName);
    }

LICENSE

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.
Comments
  • Security issue needs your help during Google Store's reviewing

    Security issue needs your help during Google Store's reviewing

    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

    opened by Gavin-22 9
  • App Crash on INCREMENT Patch update.

    App Crash on INCREMENT Patch update.

    log cat

    05-14 19:36:58.865  1662  1881 I ActivityTaskManager: Fully drawn in.canews.movieroar/.MainActivity: +1s559ms
    05-14 19:36:58.871 30945  8094 I anews.movieroa: Waiting for a blocking GC ProfileSaver
    05-14 19:36:58.888 30945  8203 I DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
    05-14 19:36:58.888 30945  8203 W ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
    05-14 19:36:58.903 30945  8203 I anews.movieroa: The ClassLoaderContext is a special shared library.
    05-14 19:36:58.908 30945  8203 I anews.movieroa: The ClassLoaderContext is a special shared library.
    05-14 19:36:58.945 30945  8203 V NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 287 native methods...
    05-14 19:36:58.951  1339  2064 E statsd  : Found dropped events: 1 error -19 last atom tag 240 from uid 10510
    05-14 19:36:58.961 30945  8203 I ProviderInstaller: Installed default security provider GmsCore_OpenSSL
    05-14 19:36:58.976  1662  3772 D WifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ] with score 60 and providerId 6
    05-14 19:36:58.976  1662  3772 D UntrustedWifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ] with score 60 and providerId 605-14 19:36:58.977  4391  4391 D PhoneSwitcherNetworkRequstListener: got request NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ] with score 60 and providerId 6
    05-14 19:36:58.979  1662  3819 D WIFI_AWARE_FACTORY: got request NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ] with score 60 and providerId 6
    05-14 19:36:58.979  1662  3820 D Ethernet: got request NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ] with score 60 and providerId 6
    05-14 19:36:59.301 30945  8192 D r_upgrade.Service: run: code=200
    05-14 19:36:59.301 30945  8192 D r_upgrade.Service: run: maxLength:10232472
    05-14 19:36:59.414   837  8650 D qc_adm  : ns 2627761 > expected_ns 2000000 (skipped 77)
    05-14 19:36:59.423   837  8650 D qc_adm  : ns 2601875 > expected_ns 2000000 (skipped 77)
    05-14 19:36:59.772 30945  8194 D r_upgrade.Service: handlerDownloadRunning: running queryTask: 下载中
    05-14 19:36:59.772 30945  8194 D r_upgrade.Service: url: https://github.com/canewsin/test/releases/download/0/inc.patch
    05-14 19:36:59.772 30945  8194 D r_upgrade.Service: ============>total:10232472,progress:1482203,14.17% , 1405.62kb/s , 预计:6s
    05-14 19:36:59.800  5465  5465 D BoundBrokerSvc: onUnbind: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
    05-14 19:36:59.853 20248 20287 D QCNEJ/WlanStaInfoRelay: Received action: android.net.wifi.RSSI_CHANGED
    05-14 19:36:59.856  4308  6985 D QCNEJ/WlanStaInfoRelay: Received action: android.net.wifi.RSSI_CHANGED
    05-14 19:36:59.911 10427 10484 I CarrierServices: [8038] bze.e: (PEv2-SM-130103966): DisabledState: event Connectivity event [null]
    05-14 19:36:59.911 10427 10500 I CarrierServices: [8040] bsw.d: Connected state: [1], networkType: [WIFI]
    05-14 19:36:59.926 10427 10502 I CarrierServices: [8041] cfn.m: No RCS Configuration was found in Bugle for simID: redacted-pii:sim_id[20-chars]
    05-14 19:36:59.986  1662  1662 D NotificationService: 0|in.canews.movieroar|2|null|10510: granting content://settings/system/notification_sound
    05-14 22:09:00.689     0     0 I         : Alarmtimer { AlarmManager', '44710671'}
    05-14 19:37:00.272   854  1486 I SDM     : HWCDisplayBuiltIn::parseOutputBuffer: w 1080 h 2340 stride 1088 size 10186752 Bpp 4
    05-14 19:37:00.273 30945  8194 D r_upgrade.Service: handlerDownloadRunning: running queryTask: 下载中
    05-14 19:37:00.273 30945  8194 D r_upgrade.Service: url: https://github.com/canewsin/test/releases/download/0/inc.patch
    05-14 19:37:00.273 30945  8194 D r_upgrade.Service: ============>total:10232472,progress:3464667,33.66% , 3870.97kb/s , 预计:2s
    05-14 19:37:00.771 30945  8194 D r_upgrade.Service: handlerDownloadRunning: running queryTask: 下载中
    05-14 19:37:00.771 30945  8194 D r_upgrade.Service: url: https://github.com/canewsin/test/releases/download/0/inc.patch
    05-14 19:37:00.771 30945  8194 D r_upgrade.Service: ============>total:10232472,progress:5529051,53.96% , 4080.97kb/s , 预计:1s
    05-14 19:37:01.271 30945  8194 D r_upgrade.Service: handlerDownloadRunning: running queryTask: 下载中
    05-14 19:37:01.271 30945  8194 D r_upgrade.Service: url: https://github.com/canewsin/test/releases/download/0/inc.patch
    05-14 19:37:01.271 30945  8194 D r_upgrade.Service: ============>total:10232472,progress:7773659,75.97% , 4428.28kb/s , 预计:1s
    05-14 19:37:01.773 30945  8194 D r_upgrade.Service: handlerDownloadRunning: running queryTask: 下载中
    05-14 19:37:01.773 30945  8194 D r_upgrade.Service: url: https://github.com/canewsin/test/releases/download/0/inc.patch
    05-14 19:37:01.773 30945  8194 D r_upgrade.Service: ============>total:10232472,progress:9838043,95.99% , 4024.14kb/s , 预计:0s
    05-14 19:37:01.858 30945  8192 D r_upgrade.Service: handlerDownloadFinish: finish
    05-14 19:36:59.990  1662  1662 D NotificationService: 0|in.canews.movieroar|2|null|10510: granting content://settings/system/notification_sound
    05-14 19:37:02.333  5465  5465 D BoundBrokerSvc: onBind: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
    05-14 19:37:02.333  5465  5465 D BoundBrokerSvc: Loading bound service for intent: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
    05-14 19:37:02.376  1173  8074 I iorapd  : Perfetto TraceBuffer saved to file: /data/misc/iorapd/in.canews.movieroar/1/in.canews.movieroar.MainActivity/raw_traces/1621001222375156961.perfetto_trace.pb
    05-14 19:37:02.401  8366  8403 W FA      : Analytics storage consent denied; will not get app instance id
    05-14 19:37:02.483  8366  8430 W System.err: java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS (Read-only file system)
    05-14 19:37:02.483  8366  8430 W System.err:    at libcore.io.IoBridge.open(IoBridge.java:492)
    05-14 19:37:02.483  8366  8430 W System.err:    at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.h.a.a(SourceFile:1)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.h.a.startup(SourceFile:6)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.a.startup(SourceFile:5)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.a.getInstance(SourceFile:3)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.e.<clinit>(SourceFile:2)
    05-14 19:37:02.483  8366  8430 W System.err:    at w.c.a.a.b.e.getProbes(SourceFile:1)
    05-14 19:37:02.483  8366  8430 W System.err:    at e.m.b.c.j2.n0.a(Unknown Source:13)
    05-14 19:37:02.483  8366  8430 W System.err:    at e.m.b.c.j2.n0.<clinit>(Unknown Source:0)
    05-14 19:37:02.483  8366  8430 W System.err:    at e.m.b.c.j2.n0.getUserAgent(Unknown Source:0)
    05-14 19:37:02.483  8366  8430 W System.err:    at com.wynk.atvdownloader.download.ATVDownloadHelper.<init>(SourceFile:3)
    05-14 19:37:02.484  8366  8430 W System.err:    at com.wynk.atvdownloader.download.ATVDownloadHelper$Companion$1.invoke(SourceFile:1)
    05-14 19:37:02.484  8366  8430 W System.err:    at com.wynk.atvdownloader.download.ATVDownloadHelper$Companion$1.invoke(SourceFile:2)
    05-14 19:37:02.484  8366  8430 W System.err:    at e.w.a.e.a.getInstance(SourceFile:4)
    05-14 19:37:02.484  8366  8430 W System.err:    at tv.accedo.wynk.android.airtel.WynkApplication.e(SourceFile:1)
    05-14 19:37:02.484  8366  8430 W System.err:    at tv.accedo.wynk.android.airtel.WynkApplication.access$initAtvDownloader(SourceFile:1)
    05-14 19:37:02.484  8366  8430 W System.err:    at tv.accedo.wynk.android.airtel.WynkApplication$initLibraries$1.invokeSuspend(SourceFile:22)
    05-14 19:37:02.484  8366  8430 W System.err:    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:3)
    05-14 19:37:02.484  8366  8430 W System.err:    at r.a.u0.run(SourceFile:18)
    05-14 19:37:02.484  8366  8430 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
    05-14 19:37:02.484  8366  8430 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$b.a(SourceFile:17)
    05-14 19:37:02.484  8366  8430 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$b.d(SourceFile:4)
    05-14 19:37:02.484  8366  8430 W System.err:    at kotlinx.coroutines.scheduling.CoroutineScheduler$b.run(SourceFile:1)
    05-14 19:37:02.484  8366  8430 W System.err: Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
    05-14 19:37:02.484  8366  8430 W System.err:    at libcore.io.Linux.open(Native Method)
    05-14 19:37:02.484  8366  8430 W System.err:    at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
    05-14 19:37:02.484  8366  8430 W System.err:    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
    05-14 19:37:02.484  8366  8430 W System.err:    at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
    05-14 19:37:02.484  8366  8430 W System.err:    at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)
    05-14 19:37:02.484  8366  8430 W System.err:    at libcore.io.IoBridge.open(IoBridge.java:478)
    05-14 19:37:02.484  8366  8430 W System.err:    ... 23 more
    05-14 22:09:03.212     0     0 I IRQ 6   : no longer affine to CPU6
    05-14 22:09:03.246     0     0 I         : Alarmtimer { AlarmManager', '44710671'}
    05-14 22:09:03.248     0     0 I         : Alarmtimer { Binder:1662_5', '44710671'}
    05-14 22:09:03.248     0     0 I         : Alarmtimer { AlarmManager', '44710671'}
    05-14 22:09:03.271     0     0 I         : Alarmtimer { system_server', '44710671'}
    05-14 19:37:02.592  1662  3772 D WifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1455, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.592  1662  3772 D UntrustedWifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1455, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.593  1662  3819 D WIFI_AWARE_FACTORY: got request NetworkRequest [ TRACK_DEFAULT id=1455, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.593  1662  3820 D Ethernet: got request NetworkRequest [ TRACK_DEFAULT id=1455, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.593  4391  4391 D PhoneSwitcherNetworkRequstListener: got request NetworkRequest [ TRACK_DEFAULT id=1455, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.614  4391  4391 D PhoneSwitcherNetworkRequstListener: got request NetworkRequest [ TRACK_DEFAULT id=1456, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.615  1662  3819 D WIFI_AWARE_FACTORY: got request NetworkRequest [ TRACK_DEFAULT id=1456, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.615  1662  3772 D WifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1456, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.615  1662  3772 D UntrustedWifiNetworkFactory: got request NetworkRequest [ TRACK_DEFAULT id=1456, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.615  1662  3820 D Ethernet: got request NetworkRequest [ TRACK_DEFAULT id=1456, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10452 AdministratorUids: [] RequestorUid: 10452 RequestorPackageName: tv.accedo.airtel.wynk] ] with score 60 and providerId 6
    05-14 19:37:02.619  5556  5556 W AppIndexingScheduler: [main] Full index started
    05-14 19:37:02.661  1662  3987 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service tv.accedo.airtel.wynk/tv.accedo.wynk.android.blocks.service.download.AppDownloadService
    05-14 19:37:02.772  8366  8396 W FA      : Value is too long; discarded. Value kind, name, value length: user property, productId, 68
    05-14 19:37:02.703  1662  3987 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service tv.accedo.airtel.wynk/tv.accedo.wynk.android.blocks.service.download.AppDownloadService
    05-14 19:37:02.863  1662  1662 D NotificationService: 0|tv.accedo.airtel.wynk|1|null|10452: granting content://settings/system/notification_sound05-14 19:37:03.024   854  1486 I SDM     : HWCDisplayBuiltIn::parseOutputBuffer: w 1080 h 2340 stride 1088 size 10186752 Bpp 4
    05-14 22:09:04.836     0     0 I chatty  : uid=0(root) logd identical 5 lines
    05-14 22:09:04.836     0     0 E msm_bus_device 16e0000.ad-hoc-bus: TCS Busy, retrying RPMH message send
    05-14 22:09:04.893     0     0 I IRQ 6   : no longer affine to CPU5
    05-14 22:09:04.953     0     0 I FG      : soc_work_fn: adjust_soc: s 34 r 134521 i -1264 v 3978 t 382 cc 417 m 0x56
    05-14 19:37:04.344  4662  5961 W CCTFlatFileLogStore: Excessive logging: 2048 events, 462165 bytes from log source PEOPLE_AUTOCOMPLETE last 653s
    05-14 22:09:06.233     0     0 I FG      : fg_battery_soc_smooth_tracking: soc:34, last_soc:34, raw_soc:34, soc_changed:1.
    05-14 22:09:06.233     0     0 I FG      : soc_monitor_work: soc:34, raw_soc:34, c:-1276366, s:1
    05-14 19:37:05.716   863  3834 I WifiHAL : event received NL80211_CMD_VENDOR, vendor_id = 0x1374, subcmd = 0xd
    05-14 19:37:05.717  1356  1356 I cnss-daemon: nl80211 response handler invoked
    05-14 19:37:05.717  1356  1356 I cnss-daemon: nl80211_response_handler: cmd 103, vendorID 4980, subcmd 13  received
    05-14 19:37:05.731  1662  2225 W InputDispatcher: channel '617baf1 in.canews.movieroar/in.canews.movieroar.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
    05-14 19:37:05.732  1662  2225 E InputDispatcher: channel '617baf1 in.canews.movieroar/in.canews.movieroar.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    05-14 19:37:02.864  1662  1662 I chatty  : uid=1000 system_server identical 5 lines
    05-14 19:37:02.864  1662  1662 D NotificationService: 0|tv.accedo.airtel.wynk|1|null|10452: granting content://settings/system/notification_sound05-14 19:37:05.739  1662  4702 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ TRACK_DEFAULT id=1453, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ], android.os.BinderProxy@3dd784a)
    05-14 19:37:05.739  1662  4685 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ TRACK_DEFAULT id=1454, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10510 AdministratorUids: [] RequestorUid: 10510 RequestorPackageName: in.canews.movieroar] ], android.os.BinderProxy@32ef3bb)
    05-14 19:37:05.740  1662  5660 I ActivityManager: Process in.canews.movieroar (pid 30945) has died: fg  TOP
    05-14 19:37:05.743  1662  5660 W ActivityManager: Scheduling restart of crashed service in.canews.movieroar/com.example.r_upgrade.common.UpgradeService in 1000ms for start-requested
    05-14 19:37:05.744  8131  8131 I cr_ChildProcessService: Destroying ChildProcessService pid=8131
    05-14 19:37:05.745   771   771 I Zygote  : Process 30945 exited cleanly (1)
    05-14 19:37:05.746  8131  8131 I ocessService0:: System.exit called, status: 0
    05-14 19:37:05.746  8131  8131 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.
    05-14 19:37:05.747  1662  5658 I WindowManager: WIN DEATH: Window{617baf1 u0 in.canews.movieroar/in.canews.movieroar.MainActivity}
    05-14 19:37:05.748  1662  5658 W InputDispatcher: Attempted to unregister already unregistered input channel '617baf1 in.canews.movieroar/in.canews.movieroar.MainActivity (server)'
    05-14 19:37:05.760  1662  5660 W ActivityTaskManager: Force removing ActivityRecord{14febd6 u0 in.canews.movieroar/.MainActivity t469}: app died, no saved state
    05-14 19:37:05.781  1662  5660 I ActivityManager: Killing 8131:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a510i75 (adj 0): isolated not needed
    05-14 19:37:05.785  1662  1896 I libprocessgroup: Successfully killed process cgroup uid 10510 pid 30945 in 44ms
    05-14 19:37:05.785  1662  1896 I libprocessgroup: Successfully killed process cgroup uid 99075 pid 8131 in 0ms
    05-14 19:37:05.789  1662  1866 W ActivityManager: setHasOverlayUi called on unknown pid: 30945
    05-14 19:37:05.790  3754  3970 I BtGatt.ScanManager: msg.what = 6
    05-14 19:37:05.814  4205  4205 I Zygote  : Process 8131 exited cleanly (0)
    
    opened by canewsin 7
  • 下载完apk ,安装的时候报错,使用的手机是三星,android 版本6.0.1,

    下载完apk ,安装的时候报错,使用的手机是三星,android 版本6.0.1,

    试了一下,用你的demo 在这个手机上也不行

    D/Instrumentation(16066): checkStartActivityResult() : Intent { act=android.intent.action.VIEW dat=content://com.example.r_upgrade_example.fileProvider/external_storage_root/Download/r_upgrade.apk typ=application/vnd.android.package-archive flg=0x10000001 } D/Instrumentation(16066): checkStartActivityResult() : intent is instance of [Intent]. E/MethodChannel#com.rhyme/r_upgrade_method(16066): Failed to handle method call E/MethodChannel#com.rhyme/r_upgrade_method(16066): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.example.r_upgrade_example.fileProvider/external_storage_root/Download/r_upgrade.apk typ=application/vnd.android.package-archive flg=0x10000001 } E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1879) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1546) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.app.ContextImpl.startActivity(ContextImpl.java:745) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.app.ContextImpl.startActivity(ContextImpl.java:727) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.content.ContextWrapper.startActivity(ContextWrapper.java:345) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.content.ContextWrapper.startActivity(ContextWrapper.java:345) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.example.r_upgrade.common.UpgradeManager.installApk(UpgradeManager.java:266) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.example.r_upgrade.common.UpgradeManager.installApkById(UpgradeManager.java:284) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.example.r_upgrade.method.RUpgradeMethodEnum$3.handler(RUpgradeMethodEnum.java:33) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.example.r_upgrade.method.RUpgradeMethodCallHandler.onMethodCall(RUpgradeMethodCallHandler.java:13) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.os.MessageQueue.next(MessageQueue.java:323) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.os.Looper.loop(Looper.java:135) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at android.app.ActivityThread.main(ActivityThread.java:7224) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) E/MethodChannel#com.rhyme/r_upgrade_method(16066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) E/flutter (16066): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.example.r_upgrade_example.fileProvider/external_storage_root/Download/r_upgrade.apk typ=application/vnd.android.package-archive flg=0x10000001 }, null) E/flutter (16066): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7) E/flutter (16066): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33) E/flutter (16066): E/flutter (16066): #2 RUpgrade.install (package:r_upgrade/r_upgrade.dart:81:33) E/flutter (16066): #3 _MyAppState._buildAndroidPlatformWidget. (package:r_upgrade_example/main.dart:98:47) E/flutter (16066): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14) E/flutter (16066): #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36) E/flutter (16066): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24) E/flutter (16066): #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11) E/flutter (16066): #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5) E/flutter (16066): #9 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7) E/flutter (16066): #10 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27) E/flutter (16066): #11 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20) E/flutter (16066): #12 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22) E/flutter (16066): #13 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7) E/flutter (16066): #14 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7) E/flutter (16066): #15 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7) E/flutter (16066): #16 _rootRunUnary (dart:async/zone.dart:1138:13) E/flutter (16066): #17 _CustomZone.runUnary (dart:async/zone.dart:1031:19) E/flutter (16066): #18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) E/flutter (16066): #19 _invoke1 (dart:ui/hooks.dart:273:10) E/flutter (16066): #20 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5) E/flutter (16066):

    opened by xiaojiedeVX 6
  • 在debug模式下,使用r_upgrade后,每退出一次app都报一次错误

    在debug模式下,使用r_upgrade后,每退出一次app都报一次错误

    1、使用版本为: ^0.3.1

    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()?

    3、希望作者能解决这个问题

    注: 感觉您这个插件蛮好用的

    opened by zhongyinghe 5
  • flutter run --release 模式下,无法进行热更新

    flutter run --release 模式下,无法进行热更新

    flutter run 调试模式是可以进行热更新的, 代码是用的 https://github.com/rhymelph/r_upgrade/tree/master/example

    我的环境 Flutter version 2.2.0 at F:\flutter\flutter2.2.0 • Framework revision b22742018b (8 months ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

    opened by justdoitgo 3
  • run for ios error

    run for ios error

    1 warning generated. ~/.pub-cache/hosted/pub.flutter-io.cn/r_upgrade-0.3.2+3/ios/Classes/RUpgradePlugin.m:2:9: fatal error: 'r_upgrade/r_upgrade-Swift.h' file not found #import <r_upgrade/r_upgrade-Swift.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    opened by hzysunrain 3
  • Any API to get new version available or not from Google Store ?

    Any API to get new version available or not from Google Store ?

    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 ?

    Thank you in advance for your feedback !

    enhancement 
    opened by Gavin-22 3
  • 空指针了。

    空指针了。

         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) 
    
    question 
    opened by JarvanMo 3
  • There was a problem to parsing the package.

    There was a problem to parsing the package.

    Basic Info:

    • Flutter/Dart SDK: Dart 2.18.0 + Flutter 3.3.5
    • Null-safety enabled: No
    • Reproducibility: Always
    • OS: macOS 12.6 (Chip Apple M1 Pro)
    • Device: Pixel 2 (OS Android 11) (API Level 29)

    Code:

    void upgrade() async {
        apkDownloadId = await RUpgrade.upgrade(
            'https://drive.google.com/file/d/1CyKTQp8Xx9KkL6LaFzGk3-fy8TeGUC91/view?usp=share_link',
            fileName: 'crm_hafooz_dev_19.apk',
            notificationVisibility: NotificationVisibility.VISIBILITY_VISIBLE,
            notificationStyle: NotificationStyle.planTimeAndSpeech,
            installType: RUpgradeInstallType.normal,
            useDownloadManager: false);
      }
    

    Error Message: There was a problem to parsing the package.

    image

    opened by MohammadAliK 2
  • Android 12 FLAG_IMMUTABLE

    Android 12 FLAG_IMMUTABLE

    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.

    opened by XMitja 2
  • 2个必现的bug

    2个必现的bug

    • miui 12
    • android 10
    • flutter stable

    useDownloadManager: false 下载完成后通知栏的notification不会自动消失(notificationVisibility = NotificationVisibility.VISIBILITY_VISIBLE)

    useDownloadManager: true的时候 拉起安装页面-不做任何操作,直接返回,一回到我们的app就会跳回到安装页(useDownloadManager为false的不会有这个问题),log疯狂输出如下

    I/Timeline(11488): Timeline: Activity_launch_request time:127296962
    D/r_upgrade.Manager(11488): queryTask: 下载成功
    D/r_upgrade.AsyncTask(11488): content://downloads/all_downloads/59
    I/Timeline(11488): Timeline: Activity_launch_request time:127297489
    D/r_upgrade.Manager(11488): queryTask: 下载成功
    D/r_upgrade.AsyncTask(11488): content://downloads/all_downloads/59
    I/Timeline(11488): Timeline: Activity_launch_request time:127298032
    D/r_upgrade.Manager(11488): queryTask: 下载成功
    D/r_upgrade.AsyncTask(11488): content://downloads/all_downloads/59
    I/Timeline(11488): Timeline: Activity_launch_request time:127298571
    
    bug 
    opened by MelonWXD 2
  • 电视的系统报错,是不是因为系统被阉割了. 安卓8.0

    电视的系统报错,是不是因为系统被阉割了. 安卓8.0

    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)

    opened by hpp0hpp 0
  • 安卓端切换到后台/息屏时,有时候会下载暂停,或下载失败,有什么解决方案吗?

    安卓端切换到后台/息屏时,有时候会下载暂停,或下载失败,有什么解决方案吗?

    我在文档或Issues里没有看到这些情况下改怎么处理。是否和安卓的机制有关?

    这是我的下载点击事件

    _downloadApk(String url, String path) async {
        if (_downloadTaskId != null) {
          int? lastId = await RUpgrade.getLastUpgradedId();
          DownloadStatus? lastStatus;
          if (lastId != null) {
            lastStatus = await RUpgrade.getDownloadStatus(lastId);
            if (lastStatus == DownloadStatus.STATUS_SUCCESSFUL) {
              // ! 下载成功
              await RUpgrade.install(lastId);
              return;
            } else if (lastStatus == DownloadStatus.STATUS_PENDING) {
              // ! 下载等待
              bool? result = await RUpgrade.upgradeWithId(lastId);
              if (result != null && result) {
                setState(() {
                  _downloadStatusText = '等待下载';
                  _downloadStatus = DownloadStatus.STATUS_PENDING;
                });
                return;
              }
            } else if (lastStatus == DownloadStatus.STATUS_FAILED) {
              // ! 下载失败
              RUpgrade.cancel(lastId);
              setState(() {
                _downloadTaskId = null;
                _downloadProgress = 0;
                _downloadStatusText = '';
                _downloadStatus = DownloadStatus.STATUS_SUCCESSFUL;
              });
            } else if (lastStatus == DownloadStatus.STATUS_PAUSED) {
              // ! 下载暂停
              await RUpgrade.upgradeWithId(lastId);
              return;
            }
          }
        }
        int? id;
        // 下载中 再次点击按钮返回
        if (_downloadStatus == DownloadStatus.STATUS_RUNNING) {
          return;
        }
        if (_downloadStatus == DownloadStatus.STATUS_SUCCESSFUL && _downloadTaskId != null) {
          bool? isSuccess = await RUpgrade.install(_downloadTaskId!);
          if (isSuccess != null) {
            setState(() {
              _downloadStatus = null;
              _downloadProgress = 0.0;
              _downloadStatusText = '';
            });
          }
        }
        id = await RUpgrade.upgrade(url,
            fileName: 'demo.apk', installType: RUpgradeInstallType.normal, notificationStyle: NotificationStyle.speech);
    
        setState(() {
          _downloadTaskId = id;
        });
      }
    
    opened by virzs 3
  • java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.r_upgrade.RECEIVER_CANCEL

    java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.r_upgrade.RECEIVER_CANCEL

    Version:0.3.8+2 小米手机,具体操作:打开WIFi 和 流量下载 - > 触发下载 -> 关闭WiFi,自动切换到流量下载 ->打开WIFi -> 关闭流量下载 重复以上操作会几率触发

    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

    opened by summeryi 0
  • fatal error: 'r_upgrade/r_upgrade-Swift.h' file not found

    fatal error: 'r_upgrade/r_upgrade-Swift.h' file not found

    看过其他issues里面的解决方案了 对我都不生效 理论上podfile里面使用 user_framework 可以安装上 但是如果我user_framework 我其他的很多库就不能用了 flutter是2.5版本 xcode是13 都是最新版 项目当时创立的时候是OC的 楼主说的那个删掉重新创建swift版本的风险对我来说太大了 请问作者还有其他的解决办法吗 作者能否提供个联系方式啊

    question 
    opened by lcm1475 8
Releases(v0.3.0-example)
Owner
PengHui Li
print("Hello World");
PengHui Li
Iridium-reader-widget - Plug and play reader widget allowing to easily integrate an Iridium viewer inside any app

Plug and play reader widget allowing to easily integrate an Iridium viewer insid

Mantano 15 Dec 31, 2022
Download files from Firebase Storage with Flutter. List all images, videos, or other files from Firebase and download them.

Flutter Tutorial - Download Files From Firebase Storage Download files from Firebase Storage with Flutter. List all images, videos, or other files fro

Johannes Milke 28 Dec 4, 2022
Flutter Download Manager is a Cross-Platform file downloader with Parallel and Batch Download support

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.

Nabil Mosharraf 11 Dec 17, 2022
Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Upgrader Flutter package for prompting users to upgrade when there is a newer version of the app in the store. When a newer app version is availabe in

Larry Aasen 362 Jan 1, 2023
A Mobile Application to Download Books

LibHive (Android) - Download Free Books, PDFs, Epubs LibHive is an mobile application where you can search,download,save books anytime. These books ar

Abiraj Rajendran 13 Nov 17, 2022
A Flutter widget that checks and displays the version status of application and you can easily guide user to update your app

A most easily usable Flutter widget about application version check! 1. About 1.

Kato Shinya 1 Dec 16, 2021
Flutter youtube downloader - A Windows App made in Flutter to download mp3 or mp4 from a Youtube video

youtube_downloader A Windows App made in Flutter to download mp3 or mp4 from a Y

Sakshham Bhagat 3 Nov 30, 2022
Its a simple app which gives Weather Update, Bit Coin Value Comparator, and Flash Chat Application

Bundle_App_MajorProject Description : Its a simple app which is a bundle of Weather Update App, Bit Coin Value Comparator App, and Flash Chat Applicat

Avinandan Bose 2 Sep 9, 2022
Simple & Beautiful App (Tool) made in Flutter to Download Media from YouTube. Based on the original SongTube App repository.

songtube A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

SongTube 11 Dec 18, 2022
This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.

Bitrise Artifact Downloader Introduction ??‍♂️ This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise proj

Jens Klingenberg 9 Apr 30, 2021
A simple flutter app that downloads a file from the internet, shows a custom-made download progress dialog and saves the file to device's internal storage

http_downloader A simple flutter app that downloads a file from the internet using the http plugin. It has a custom-designed progress dialog which dis

Akora Ing. Debrah Kwesi Buabeng 4 Apr 6, 2021
A Flutter App To Download Videos From YouTube In Mp3 Format

Flutter_YouTube_MP3 App A Simple app To Download mp3 Videos From YouTube ❤️ Found this project useful? If you found this project useful, then please c

Sheraz Mahar 24 Dec 19, 2022
Simple & Beautiful App (Tool) made in Flutter to Download Media from YouTube

SongTube is a new beautiful and fast application made in flutter, it supports YouTube audio and video downloading at any quality, In-App YouTube Brows

SongTube 805 Dec 30, 2022
A font loader to download, cache and load web fonts in flutter with support for Firebase Cloud Storage.

Dynamic Cached Fonts A simple, easy to use yet customizable font loader to use web fonts. Demo: https://sidrao2006.github.io/dynamic_cached_fonts ?? I

Aneesh Rao 18 Dec 21, 2022
Flutter Downloader - A plugin for creating and managing download tasks. Supports iOS and Android.

Flutter Downloader A plugin for creating and managing download tasks. Supports iOS and Android. This plugin is based on WorkManager in Android and NSU

Flutter Community 789 Jan 3, 2023
dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on background

dosdownloader Dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on back

Md Abir Ahsan Tahmim 1 Dec 8, 2021
Complete example to download reels from instagram link and save to gellery

Flutter-Reels-downloader-for-instagram A Flutter project to download reels from instagram via link. Features: Download instagram reels Play reels Save

Ravindra Vala 22 Dec 30, 2022
Package to get details of the Instagram user and download reels video.

Flutter package to get Instagram user details and download reels videos. How to Use To use flutter_insta, first start by importing the package. import

Viral Vaghela 49 Nov 12, 2022
🚀 Simple library to download files easily.

Dart DL Simple library to download files easily. Links GitHub Pub.dev Documentation Features Uses native dart:io to get data. Ability to parse differe

ZYROUGE 2 Feb 11, 2022