diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-09-21 18:20:53 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-09-23 22:22:01 +0200 |
commit | 963ceb5d133a2a4404b834fddcff3cf0652cfeb7 (patch) | |
tree | 5e4166bf9c9342a62df7e48a04a7415a5eab7c05 /src/main/java/de/pixart | |
parent | 7b2cecde1967c64b46f862b971b4afb5d29dbf7e (diff) |
Don't use file provider for photo uris on android < N. fixes #2030
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index cb586b935..771bdddbd 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -462,10 +462,14 @@ public class FileBackend { pathBuilder.append('/'); pathBuilder.append("Camera"); pathBuilder.append('/'); - pathBuilder.append(this.fileDateFormat.format(new Date()) + ".jpg"); + pathBuilder.append("IMG_" + this.fileDateFormat.format(new Date()) + ".jpg"); File file = new File(pathBuilder.toString()); file.getParentFile().mkdirs(); - return FileProvider.getUriForFile(mXmppConnectionService,"de.pixart.messenger.files",file); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + return FileProvider.getUriForFile(mXmppConnectionService,"de.pixart.messenger.files",file); + } else { + return Uri.fromFile(file); + } } public Avatar getPepAvatar(Uri image, int size, Bitmap.CompressFormat format) { |