diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java b/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java index eabb7518..54fe3910 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/ExportLogsPreference.java @@ -1,7 +1,10 @@ package de.thedevstack.conversationsplus.ui; +import android.Manifest; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; import android.preference.Preference; import android.util.AttributeSet; @@ -22,6 +25,10 @@ public class ExportLogsPreference extends Preference { } protected void onClick() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + && getContext().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + return; + } final Intent startIntent = new Intent(getContext(), ExportLogsService.class); getContext().startService(startIntent); super.onClick(); |