aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java
index 5def05dd..a1256250 100644
--- a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java
+++ b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java
@@ -1,6 +1,9 @@
package eu.siacs.conversations.services;
+import android.Manifest;
import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
import android.os.PowerManager;
import android.util.Log;
import android.util.Pair;
@@ -51,6 +54,14 @@ public class AbstractConnectionManager {
}
}
+ public boolean hasStoragePermission() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ return mXmppConnectionService.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
+ } else {
+ return true;
+ }
+ }
+
public static Pair<InputStream,Integer> createInputStream(DownloadableFile file, boolean gcm) throws FileNotFoundException {
FileInputStream is;
int size;