aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/compatibility/AndroidLevel19.java')
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel19.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java
new file mode 100644
index 0000000..ed4849f
--- /dev/null
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java
@@ -0,0 +1,25 @@
+package cgeo.geocaching.compatibility;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Intent;
+
+@TargetApi(19)
+public class AndroidLevel19 implements AndroidLevel19Interface {
+
+ @Override
+ public void importGpxFromStorageAccessFramework(final Activity activity, final int requestCode) {
+ // ACTION_OPEN_DOCUMENT is the intent to choose a file via the system's file browser.
+ Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
+
+ // Filter to only show results that can be "opened", such as a file (as opposed to a list
+ // of contacts or timezones)
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+
+ // Mime type based filter, we use "*/*" as GPX does not have a good mime type anyway
+ intent.setType("*/*");
+
+ activity.startActivityForResult(intent, requestCode);
+ }
+
+}