Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for opening file on external SD card #1

Open
javlada opened this issue Sep 19, 2018 · 1 comment
Open

Solution for opening file on external SD card #1

javlada opened this issue Sep 19, 2018 · 1 comment

Comments

@javlada
Copy link

javlada commented Sep 19, 2018

Thanks a lot for sharing the solution regarding opening files on Android. It helped me a lot. I found a solution which works at least for me regarding opening files on external drive (SD card, USB stick etc.). Please have a look my changed code in QSharePathResolver.java

            if (isExternalStorageDocument(uri)) {
                Log.d("Muzika"," isExternalStorageDocument");
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];
                Log.d("Muzika","Storage type: "+type+" ,"+split[1]);
                if ("primary".equalsIgnoreCase(type)) {
                    return Environment.getExternalStorageDirectory() + "/" + split[1];
                }
                else {
                    return "/storage/"+type+"/"+split[1];
                }
            }

Is there a problem with this solution? Unfortunately I don't have enough devices to test it generally.

@ekke
Copy link
Owner

ekke commented Sep 21, 2018

thanks for your code - will test this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants