Hello Team,
I want the user to force update the application. So, Based on the below logic, I'm opening an alert with an update option in it. When I click on the update. It is navigating to the Appstore. But when I click on the backbutton on the top left corner the app is being crashed.
MainThread.BeginInvokeOnMainThread(() =>
{
string msg = "A new version of this application is available. " +
"Please update to the new version now.";
UIAlertController dlg = UIAlertController.Create("Update Available", msg
, UIAlertControllerStyle.Alert);
// this was a remote Notification
dlg.AddAction(UIAlertAction.Create("Update", UIAlertActionStyle.Default, x =>
{
UIApplication.SharedApplication.OpenUrl(new NSUrl(appSpecificStoreLink),
new NSDictionary() { },
null);
Thread.Sleep(100);
Thread.CurrentThread.Interrupt();
}));
UIWindow window = UIApplication.SharedApplication.KeyWindow;
window.RootViewController.PresentViewController(dlg, true, null);
});
If I had removed
Thread.CurrentThread.Interrupt();
user will come back to the application from the appstore and no crashing is happing but user can able to access the application. as per my requirement. I want to restrict the user in the landing page itself.
Thanks
Vaibhav Methuku.