I want to provide a functionality in my App for which I need the permission INTERNET
.
However, not all user may want to use this functionality and since this is a very strong permission I don't want to force everyone to give it to the App if they want to use it, only if they want to use this functionality.
So I have to ask for that permission at run-time. the minimum sdk
for the App is 15 and I don't want to set it higher.
The method requestPermissions(String[],int)
, which I can call in my Activity
is only available with API 23, but I can callActivityCompat.requestPermissions(this,new String[]{Manifest.permission.INTERNET},0);
, but it doesn't no dialog is shown.
And yes, I have checked if the permission is already granted:
if(ContextCompat.checkSelfPermission(this,Manifest.permission.INTERNET)!=
PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.INTERNET},0);
What am I doing wrong?