Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differnciate between Permission asking 1st time or never ask again. #20

Open
pritishjoshi94 opened this issue Dec 7, 2017 · 1 comment

Comments

@pritishjoshi94
Copy link

pritishjoshi94 commented Dec 7, 2017

How to differentiate between the permission that I am calling is first time or user have selected on the never asked again.
In sample you have mentioned this thing.

@OnClick(R.id.buttonLocation) public void clickButtLocation() { if (Nammu.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION)) { boolean hasAccess = Tools.accessLocation(this); Toast.makeText(this, "Access granted fine= " + hasAccess, Toast.LENGTH_SHORT).show(); } else { if (Nammu.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) { //User already refused to give us this permission or removed it //Now he/she can mark "never ask again" (sic!) Snackbar.make(mLayout, "Here we explain user why we need to know his/her location.", Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() { @Override public void onClick(View view) { Nammu.askForPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION, permissionLocationCallback); } }).show(); } else { //First time asking for permission // or phone doesn't offer permission // or user marked "never ask again" Nammu.askForPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION, permissionLocationCallback); } } }

Here in comments you have mentioned
First time asking permission
or user marked "never ask again."

I want to know when user selected never asked again and proceed further

@tajchert
Copy link
Owner

Draft:

  • we keep information if user (at least once) refused to give permission
  • if user granted permission - we remove above info
  • we need to update it in Nammu.init() - monitor for background changes.

Probably I need to draw for myself a small flow chart to avoid any corner cases in terms of false positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants