Florin Laudat
Florin Laudat

Reputation: 129

Application gets restarted if the camera permission is changed

I've implemented a short Flutter App which is requesting and checking the camera permission which works as expected. But, when manually changing the camera permission from the app settings, for both Android and iOS, it will restart my app. I need to mention that I've added in AndroidManifest.xml and Info.plist the required keys for camera. One interesting thing is that for the location the behaviour is fine and the app does not get restarted.

For permissions I'm using the permission_handler flutter library.

I don't know if is a flutter issue or a general mobile known behaviour but if someone knows more please let me know. If someone need some code example I can also provide this. Thank you.

Upvotes: 7

Views: 2380

Answers (2)

Fluent Sarcasm
Fluent Sarcasm

Reputation: 19

The native Android application's onCreate method is called after a permission is changed. Sometimes it may be called instantly after permission change and sometimes the OS may take upto several minutes to invoke application's onCreate.

Upvotes: -1

bauerMusic
bauerMusic

Reputation: 6166

It doesn't get 'restarted', it gets killed. Meaning, it will run from app launch the next time. This is because some permission settings cannot be changed while the App is running. This is by design.

Upvotes: 8

Related Questions