My app uses permissions
in app i'm asking runtime permission and it works fine
BUT when doing this steps
1) using device home button going to current app settings page
2) switching off permission
3)then going back to app again with home button
it crashes without any exception
for exmaple INSTAGRAM app
1) open instagram
2) goto settings page
3) switch permission
4)return to app
it restarts, i want to do something like that
you can use method
in Manifest add android:configChanges
To use CAMERA you have to check the permission at runtime.
All the info are here.
First check if the user grant the permission:
Then, you could use this to request to the user:
u need to check for permission every time in code you are going to use the camera of memory functions https://developer.android.com/training/permissions/requesting.html
Do one thing. Check for runtime permission every time you're trying to open the camera and in onRequestPermissionsResult() handle it properly if permission is denied. Do the same for memory permission also.
try this your need to ask runtime permission because Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.
ask runtime permission using below code
and than handle result like this
read about runtime permission