From df3f10e3300860ad4ecb1fa574bfbf1a7b7b0893 Mon Sep 17 00:00:00 2001 From: Milo Thurston Date: Sun, 8 May 2016 12:35:49 +0100 Subject: [PATCH] Bugfix for exporting database. --- beecount/build.gradle | 2 +- beecount/src/main/AndroidManifest.xml | 2 +- .../java/com/knirirr/beecount/WelcomeActivity.java | 12 +++++++++--- beecount/src/main/res/raw/changelog.txt | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/beecount/build.gradle b/beecount/build.gradle index 903175b..55d100a 100644 --- a/beecount/build.gradle +++ b/beecount/build.gradle @@ -16,7 +16,7 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 115 + versionCode 116 } /* buildTypes { diff --git a/beecount/src/main/AndroidManifest.xml b/beecount/src/main/AndroidManifest.xml index 0c797ed..e4af89c 100644 --- a/beecount/src/main/AndroidManifest.xml +++ b/beecount/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ diff --git a/beecount/src/main/java/com/knirirr/beecount/WelcomeActivity.java b/beecount/src/main/java/com/knirirr/beecount/WelcomeActivity.java index 20aa8be..e4ac1f8 100644 --- a/beecount/src/main/java/com/knirirr/beecount/WelcomeActivity.java +++ b/beecount/src/main/java/com/knirirr/beecount/WelcomeActivity.java @@ -8,6 +8,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.preference.PreferenceManager; @@ -146,10 +147,15 @@ public void onSharedPreferenceChanged(SharedPreferences prefs, String key) public void exportDb() { - int hasWriteContactsPermission = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); - if (hasWriteContactsPermission != PackageManager.PERMISSION_GRANTED) + + // if API level > 23 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CODE_ASK_PERMISSIONS); + int hasWriteContactsPermission = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); + if (hasWriteContactsPermission != PackageManager.PERMISSION_GRANTED) + { + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CODE_ASK_PERMISSIONS); + } } boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; diff --git a/beecount/src/main/res/raw/changelog.txt b/beecount/src/main/res/raw/changelog.txt index 83d0b44..97b1458 100644 --- a/beecount/src/main/res/raw/changelog.txt +++ b/beecount/src/main/res/raw/changelog.txt @@ -19,6 +19,10 @@ +$ 2.4.3 + % version 2.4.3 + _ 2016-05-08 + * Bugfix for database exporting. $ 2.4.2 % version 2.4.2 _ 2016-04-16