aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java
blob: 6b15a00500acfe08fb35b52860fcfab79907226d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package cgeo.geocaching.compatibility;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;

@TargetApi(19)
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.
        final 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);
    }

}