6

I am currently working on an implementation of the new "in-app update" library of Google.

According to the documentation, we can prompt a "flexible" or an "immediate" UI to the user. In both case, it will launch the download of the update (blocking or not).

If during this download I kill my app and them re-launch it before the end of the download, when I ask for the "update availability" the API gives me the answer UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS.

The documentation mentions this availability only in the case of an immediate update so we have to restore the fullscreen UI with the following code :

appUpdateManager.startUpdateFlowForResult(appUpdateInfo, IMMEDIATE, this, 1000)

The matter is that I also have this availability when a flexible update is downloading and in this case I do not want to start a fullscreen downloading UI because it's a flexible update...

Is there any way to know if we are in a flexible or an immediate update when the API returns UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS as the availability ?

Thank you in advance for your help!

rolandl
  • 1,769
  • 1
  • 25
  • 48
  • did you find any solution? – Sai Sep 05 '19 at 21:07
  • Currently, I am saving lastKnowAppUpdateType in share preference right befoe I call startUpdateFlowForResult, then in resume check lastKnowAppUpdateType and ignore IMMEDIATE if required. – Sai Sep 05 '19 at 21:17
  • 1
    I do not find the solution yet. In my case if the availibility is DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS I launch a fullscreen immediate update just to be sure – rolandl Sep 06 '19 at 08:08
  • Im having the exact same problem. I would expect a callback to be made with the InstallStateUpdatedListener to let me know about the current state of the update but nothing happens, not even after calling startUpdateFlowForResult with the FLEXIBLE option. This feels like a bug to me. – marp Oct 14 '19 at 13:53
  • The same for me, DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS is also available for FLEXIBLE type, I'm also looking for tutorials and samples and they're still the same. Currently I'm saving in SP like @Sai did – Nhat Pham Apr 12 '20 at 07:12
  • I have put the question on the table and I got the answer from Google Developer. Please check out this https://issuetracker.google.com/issues/153785560. – Nhat Pham Apr 14 '20 at 15:21

1 Answers1

3

The API does not return whether the update was started as an immediate or flexible flow.

If you want to make sure to resume the same flow type you had started before, you have 2 options today:

  • re-run the same logic that you ran to decide what type to start initially: if the logic is deterministic, the result will be the same and you will resume the same type of flow
  • remember what type you started explicitly (persist this information)

Note that choosing the wrong flow type when resuming is not a problem: internally they work the same way, so you can start a flexible flow and resume it as immediate and vice-versa, without any issue.

Source: I work on the Play Core SDK