In my application i want to perform specific function that exist in non activity class but before perform this function should check for some permission is granted or not. I handle request permission in run time but how i can check if the user deny this permission and check never show again.
In my case i check if the permission is granted using
if(ContextCompat.checkSelfPermission(context,Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED)
but this give me false any time i check it also when set permission Always deny
from settings and when try to check it using another way
if (ActivityCompat.shouldShowRequestPermissionRationale(context, Manifest.permission.READ_CONTACTS))
but also give me false when deny permission and check never show again.
so what is the best way to check if user deny any permission and check never show again from run time permission dialog or deny it from application settings