Skip to content

Commit

Permalink
android: permission result is only valid if our request code matches
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Parker committed Mar 20, 2017
1 parent f79630e commit 8455821
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,26 @@ public void onClick(DialogInterface dialog, int which)
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
{
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode)
{
case REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS:
for (int i = 0; i < permissions.length; i++)
{
if(grantResults[i] == PackageManager.PERMISSION_GRANTED)
{
Log.i("RetroActivity", "Permission: " + permissions[i] + " was granted.");
}
else
{
Log.i("RetroActivity", "Permission: " + permissions[i] + " was not granted.");
}
}

for (int i = 0; i < permissions.length; i++)
{
if(grantResults[i] == PackageManager.PERMISSION_GRANTED)
{
Log.i("RetroActivity", "Permission: " + permissions[i] + " was granted.");
}
else
{
Log.i("RetroActivity", "Permission: " + permissions[i] + " was not granted.");
}
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
break;
}
}

public boolean isAndroidTV()
Expand Down

0 comments on commit 8455821

Please sign in to comment.