jonasbark / flutter_in_app_update

Flutter Plugin: Enables In App Updates on Android using the official Android APIs.
Other
323 stars 79 forks source link

Flexible update issue #28

Closed rahuldange09 closed 4 years ago

rahuldange09 commented 4 years ago

Hello, After checking for update, Flexible update dialog comes. But after clicking on update it starts as full screen instead of doing update in background as word flexible says. It starts full screen and even pressing back button it again launched automatically to full screen. As I saw in other app flexible one works in background.

As I another issue InAppUpdate caused trouble. It's not showing any update even new update is on play store. After some days it shows for older once. This caused big blunder as I was dependent on it.

Can you help with this. Thank you

rahuldange09 commented 4 years ago

@feilfeilundfeil any confirmation from your side?

themobilecoder commented 4 years ago

Bump on this issue.

The dialog for flexible update is shown correctly, but clicking on the update shows the fullscreen (immediate update) instead.

screen1 screen2

Please see the attached screenshot.

The code I am using is this:

      InAppUpdate.checkForUpdate().then((update) {
        if (update.updateAvailable) {
          InAppUpdate.startFlexibleUpdate();
        } 
      }).catchError((e) {
        print(e);
      });
rubenvereecken commented 4 years ago

I get exactly the same. I had a look at the relevant bit of code and can't figure out what could cause it.

    try {
      await InAppUpdate.startFlexibleUpdate();
      // This never actually happens because for some reason the download is not in background
      globalBloc.showStubbornSnackBar(
          message: '🚀 Update is ready!',
          action: SnackBarAction(
            label: 'LESSGO',
            onPressed: completeFlexibleUpdate,
          ));
    } catch (error) {
      globalBloc.showSnackBar(
        message: 'Failed to download update',
      );
    }
rubenvereecken commented 4 years ago

I have a feeling this bit might be to blame https://github.com/feilfeilundfeil/flutter_in_app_update/blob/master/android/src/main/kotlin/de/ffuf/in_app_update/InAppUpdatePlugin.kt#L141

EDIT: I played around with this a bit earlier and it is that bit that's to blame. However, without it I can't get flexible updates to work. I see them update nicely in my task bar. However, the success callback happens before the download's finished. Calling completeFlexibleUpdate seems to not do anything then. No completion screen pops up (I've read that it should), and of course the library doesn't throw any errors. It's hard to gain any more insight into this.

Last edit: This looks like a good starting point https://github.com/dhruvtaneja/flexi-update/blob/master/app/src/main/java/com/dt/flexiupdate/MainActivity.kt