-2

No code to show, but merely a question on something that I'm sure has irked other developers/users.

When a user has revoked/denied permission to their Photos for a given app and then later changes to "Read and Write", the app resets/refreshes when opening it back up. Is there a way to not have the app reset/refresh when navigating back to the app? This is a concern because when the user is prompted to change their Photos permission, the user is deep within the app and now loses any progress made on that page after the permission is changed.

I am currently using Xamarin Essentials with Xamarin Forms, if that helps any.

linktheory
  • 440
  • 1
  • 8
  • 18
  • 3
    No, the app is restarted when the permissions change. Your app can be restarted any time it isn't in the foreground. It is your responsibility to save and restore app state to provide a seamless experience. – Paulw11 Jun 04 '20 at 01:11
  • Right, but is there not a way to not restart the app? Or, is that just an iOS thing? – linktheory Jun 04 '20 at 01:13
  • 3
    The app _will_ restart. (full stop) – Daniel T. Jun 04 '20 at 01:17
  • Does this answer your question? [Having app restart itself when it detects change to privacy settings](https://stackoverflow.com/questions/15930708/having-app-restart-itself-when-it-detects-change-to-privacy-settings) – Mihail Duchev Jun 04 '20 at 07:27

2 Answers2

2

It is designed by iOS system and your app is forced to restart when you change the privacy settings. I think there is no way to get around it.

You can try to save the state in the method applicationDidEnterBackground and restore it when user come back again after changing the setting.

Refer:

Having app restart itself when it detects change to privacy settings

App crashes in background while changing permission

nevermore
  • 15,432
  • 1
  • 12
  • 30
0

There are some situations where your app gets killed and restarted: when it is swiped out, when your device is running out of power are turned off by the user, when the app is moved to the background and there isn’t enough memory for all apps, and as you noticed, when certain settings change.

The reason for the restart on settings change is that your app might be doing things that get disallowed, or it might never notice things that are suddenly allowed; many apps check these things once when the app starts, so restarting it is guaranteed to make it work correctly.

You should have code that saves the application state when the app goes in the background, and restores the state when the app is launched. That fixes not just your problem with permission changes, but will also restore the app after being swiped out or killed while in the background.

gnasher729
  • 51,477
  • 5
  • 75
  • 98