I have integrated some code to handle a logic when the app is changing from foreground to background and vice versa. When the user navigates to the home screen we are requesting some permissions for location, camera and stuff from the user. The issue is in Android, in which when permission popups in the screen, app state changes to background, but I want the actual foreground -> background functionality to be triggered. I have used AppState in react native to achieve this functionality. It would be a great help if one can elaborate why the app is going to background when permission confirmation alerts popups? Thanks in advance.
Flag the permission like whenever you are gonna ask permission make isPermissionAsk to true. and in AppState Listener - for callback function where you are doing you stuff add a check on top
if(isPermissionAsk)
{ changePermissionAsk(false); return;}
In Android or iOS the permissions are OS managed features and the doesn't have any control other than requesting permission or getting state of permission. So when a permission is required you can think of permission app is in foreground which puts your app in background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With