Skip to content

Commit

Permalink
App permission
Browse files Browse the repository at this point in the history
  • Loading branch information
krmanik committed Feb 10, 2021
1 parent 6365604 commit 7a0ffaf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Binary file added app/release/app-release.apk
Binary file not shown.
20 changes: 20 additions & 0 deletions app/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "io.infinyte7.ankiimageocclusion",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 14000,
"versionName": "14000",
"enabled": true,
"outputFile": "app-release.apk"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public void onCreate(Bundle savedInstanceState)

/* https://stackoverflow.com/questions/42275906/how-to-ask-runtime-permissions-for-camera-in-android-runtime-storage-permissio */
private boolean checkPermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
&& ContextCompat.checkSelfPermission(this, AddContentApi.READ_WRITE_PERMISSION) != PackageManager.PERMISSION_GRANTED) {
if ((ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
|| (ContextCompat.checkSelfPermission(this, AddContentApi.READ_WRITE_PERMISSION) != PackageManager.PERMISSION_GRANTED)) {
// Permission is not granted
return false;
}
Expand All @@ -90,7 +90,7 @@ private void requestPermission() {
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case PERMISSION_REQUEST_CODE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getApplicationContext(), "Permission Granted", Toast.LENGTH_SHORT).show();
loadUrl(launchUrl);
} else {
Expand Down

0 comments on commit 7a0ffaf

Please sign in to comment.