User Revoke Permission
up vote
0
down vote
favorite
When a user revokes permissions in settings of the phone for the android app, the process will be terminated/killed and when the user opens the app again, it will crash. Is there a possibility that the app will not crash in order for the user to remain in the activity he or she just left ? If there is, how? I am still new to android development.
android permissions
New contributor
|
show 1 more comment
up vote
0
down vote
favorite
When a user revokes permissions in settings of the phone for the android app, the process will be terminated/killed and when the user opens the app again, it will crash. Is there a possibility that the app will not crash in order for the user to remain in the activity he or she just left ? If there is, how? I am still new to android development.
android permissions
New contributor
4
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When a user revokes permissions in settings of the phone for the android app, the process will be terminated/killed and when the user opens the app again, it will crash. Is there a possibility that the app will not crash in order for the user to remain in the activity he or she just left ? If there is, how? I am still new to android development.
android permissions
New contributor
When a user revokes permissions in settings of the phone for the android app, the process will be terminated/killed and when the user opens the app again, it will crash. Is there a possibility that the app will not crash in order for the user to remain in the activity he or she just left ? If there is, how? I am still new to android development.
android permissions
android permissions
New contributor
New contributor
edited Nov 8 at 9:55
New contributor
asked Nov 8 at 9:21
Neil Marjun Martinez
11
11
New contributor
New contributor
4
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55
|
show 1 more comment
4
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55
4
4
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55
|
show 1 more comment
2 Answers
2
active
oldest
votes
up vote
0
down vote
When app is re-opened you can catch onResume
and check if you still have the permission to continue whatever they were doing before turning the permission off.
@Override
protected void onResume()
{
super.onResume();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{
//We have the location permission!
//We can continue :)
}
else
{
//We don't have the permission anymore :(
finish();
//Or we can request it again, maybe show a dialog saying that it's needed in order to continue?
}
}
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
add a comment |
up vote
0
down vote
Please note that requesting permissions in the onResume()
method is not a good idea, due to the fact that if for instance the user didn't grant the permission a dialog will appear asking the user to grant the permission and the activity will go in to the onPause()
state. Then if the user will deny the permission, the activity will go back to the onResume()
state and ask for the permission again, which will cause an infinite loop if the user won't approve or check the "Don't ask me again" checkBox. I suggested you implement the logic in the onStart()
method.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
When app is re-opened you can catch onResume
and check if you still have the permission to continue whatever they were doing before turning the permission off.
@Override
protected void onResume()
{
super.onResume();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{
//We have the location permission!
//We can continue :)
}
else
{
//We don't have the permission anymore :(
finish();
//Or we can request it again, maybe show a dialog saying that it's needed in order to continue?
}
}
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
add a comment |
up vote
0
down vote
When app is re-opened you can catch onResume
and check if you still have the permission to continue whatever they were doing before turning the permission off.
@Override
protected void onResume()
{
super.onResume();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{
//We have the location permission!
//We can continue :)
}
else
{
//We don't have the permission anymore :(
finish();
//Or we can request it again, maybe show a dialog saying that it's needed in order to continue?
}
}
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
add a comment |
up vote
0
down vote
up vote
0
down vote
When app is re-opened you can catch onResume
and check if you still have the permission to continue whatever they were doing before turning the permission off.
@Override
protected void onResume()
{
super.onResume();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{
//We have the location permission!
//We can continue :)
}
else
{
//We don't have the permission anymore :(
finish();
//Or we can request it again, maybe show a dialog saying that it's needed in order to continue?
}
}
When app is re-opened you can catch onResume
and check if you still have the permission to continue whatever they were doing before turning the permission off.
@Override
protected void onResume()
{
super.onResume();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{
//We have the location permission!
//We can continue :)
}
else
{
//We don't have the permission anymore :(
finish();
//Or we can request it again, maybe show a dialog saying that it's needed in order to continue?
}
}
answered Nov 8 at 9:36
Ezzy
6122621
6122621
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
add a comment |
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
still it gets error, the data during broadcast/live video will be null.
– Neil Marjun Martinez
Nov 8 at 9:52
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
If you don't have the permission anymore, you should pause whatever is broadcasting/getting the data until either 1) user gives you the permission again 2) user wants to stop whatever is happening
– Ezzy
Nov 8 at 9:54
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Not pause the permission. But if you no longer have the permission you need then you should stop whatever code is being executed that is dependant on the permission.
– Ezzy
Nov 8 at 10:02
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
Okay sir! Thank you. I understand it now! :)
– Neil Marjun Martinez
Nov 8 at 10:03
add a comment |
up vote
0
down vote
Please note that requesting permissions in the onResume()
method is not a good idea, due to the fact that if for instance the user didn't grant the permission a dialog will appear asking the user to grant the permission and the activity will go in to the onPause()
state. Then if the user will deny the permission, the activity will go back to the onResume()
state and ask for the permission again, which will cause an infinite loop if the user won't approve or check the "Don't ask me again" checkBox. I suggested you implement the logic in the onStart()
method.
add a comment |
up vote
0
down vote
Please note that requesting permissions in the onResume()
method is not a good idea, due to the fact that if for instance the user didn't grant the permission a dialog will appear asking the user to grant the permission and the activity will go in to the onPause()
state. Then if the user will deny the permission, the activity will go back to the onResume()
state and ask for the permission again, which will cause an infinite loop if the user won't approve or check the "Don't ask me again" checkBox. I suggested you implement the logic in the onStart()
method.
add a comment |
up vote
0
down vote
up vote
0
down vote
Please note that requesting permissions in the onResume()
method is not a good idea, due to the fact that if for instance the user didn't grant the permission a dialog will appear asking the user to grant the permission and the activity will go in to the onPause()
state. Then if the user will deny the permission, the activity will go back to the onResume()
state and ask for the permission again, which will cause an infinite loop if the user won't approve or check the "Don't ask me again" checkBox. I suggested you implement the logic in the onStart()
method.
Please note that requesting permissions in the onResume()
method is not a good idea, due to the fact that if for instance the user didn't grant the permission a dialog will appear asking the user to grant the permission and the activity will go in to the onPause()
state. Then if the user will deny the permission, the activity will go back to the onResume()
state and ask for the permission again, which will cause an infinite loop if the user won't approve or check the "Don't ask me again" checkBox. I suggested you implement the logic in the onStart()
method.
edited Nov 8 at 15:24
answered Nov 8 at 13:58
Dor Solomon
216
216
add a comment |
add a comment |
Neil Marjun Martinez is a new contributor. Be nice, and check out our Code of Conduct.
Neil Marjun Martinez is a new contributor. Be nice, and check out our Code of Conduct.
Neil Marjun Martinez is a new contributor. Be nice, and check out our Code of Conduct.
Neil Marjun Martinez is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204711%2fuser-revoke-permission%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4
"and when user opens the app again, it will crash" Why would it crash? Are you not checking for permission before every operation that requires a permission?
– Michael
Nov 8 at 9:25
@Michael, I was checking. I read also here that when user granted the permission and by some time he or she revokes it on the phone settings, the app is running on the background and it will terminate or kill the process after the permissions are revoked.
– Neil Marjun Martinez
Nov 8 at 9:33
Yeah I'm with you so far. What I don't understand is why the app would crash when you try to start it again. It sounds to me like your app is trying to do something that requires a permission without checking whether it has that permission. You need to check for permission every time, not just once.
– Michael
Nov 8 at 9:36
@Michael I see. I got you. Thank you so much. Appreciate it! :)
– Neil Marjun Martinez
Nov 8 at 9:41
@Michael, even if I added codes in my onResume, all the data will be null causes the app to crash.
– Neil Marjun Martinez
Nov 8 at 9:55