0

All the examples I see for in-app updates are for Activities, but I have a Splash fragment where I do some basic validation on what the application needs before I get started and it seems like an ideal place for the update workflow.

I have seen this link which referenced this document and shows that you can call this:

startUpdateFlowForResult(appUpdateInfo, AppUpdateType.IMMEDIATE, fragment::startIntentSenderForResult, UPDATER_REQUEST_CODE)

I overrode the startIntentSenderForResult in the fragment:

@Override
public void startIntentSenderForResult(IntentSender intent, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, @Nullable Bundle options) throws IntentSender.SendIntentException {
    super.startIntentSenderForResult(intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options);
}

But I am getting an error "Cannot resolve method 'startIntentSenderForResult'" and when I have the method created by the error dialog, it creates a static one, which give me another error: "Static method...cannot override instance method...in 'androidx.fragment.app.Fragment'"

Does anybody know how to solve this issue? I also seem to be jumping through a lot of hoops to use in-app updates from within Fragments, which seems the way you should use it if you are suing fragments, but does not seem to be the norm. Do others just do this in the MainActivity even if they are using fragments?

lcj
  • 1,355
  • 16
  • 37
  • Are you calling that `startUpdateFlowForResult` in your fragment? If so, are you actually typing `fragment::startIntentSenderForResult`? You'd want to use `::startIntentSenderForResult` if you're referencing the method on the current class – ianhanniballake May 08 '21 at 19:52
  • Yes. I am calling it from the fragment. The call is SplashFragment::startIntentSenderForResult and actually select the method as it appears. I added the method by generating the override from android studio. – lcj May 08 '21 at 23:02
  • No, you have to leave out the `SplashFragment` part – ianhanniballake May 08 '21 at 23:49
  • I replaced it with fragment::startIntentSenderForResult and the fragment is showing an error: cannot resolve symbol 'fragment' – lcj May 09 '21 at 01:31
  • ...I don't think you're understanding what I mean by leaving it out. There should be *nothing* in front of the `::` at all. – ianhanniballake May 09 '21 at 01:35
  • So the third parameter is ::startIntentSenderForResult? The error is ')' expected. – lcj May 09 '21 at 03:31

0 Answers0