App.OnResume isn't called when returning app with back button - Xamarin.Forms Android

rnuryapici 6 Reputation points
2021-02-02T06:23:31.707+00:00

I have implemented force update feature. When app launched, if there is a newer version, dialog is displayed. User is directed to store page of application after user clicked to button on dialog. I used Xamarin.Essentials' Launcher.TryOpenAsync() to direct user to play store. Whenever user returns to app without updating, force update dialog should be displayed. I control this on App.xaml.cs's OnResume function.

If user press hardware back button while store page is loading, OnResume on mainactivity is getting called but OnResume on App.xaml.cs isn't. Naturally force update dialog isn't displayed in this case and app stays idle. But if user waits a couple of seconds longer on store page then press back button, it works perfectly fine -App.xaml.cs OnResume called.
I suspect it is related to the life cycle but I don't know how to prevent this or what I should do.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.