Reputation: 107
I want to get a file from my SD CARD to the mobile web browser(chrome). I have the fixed path for it for ex sd/ECG/12345.pdf
and I want to do it from the browser itself without selecting the path every time and just click a button which goes to that path every time automatically and show the file. How to do it?
Upvotes: 4
Views: 1177
Reputation: 681
Try this URL in browser
file://sdcard/ECG/12345.pdf
I'm not sure it's allowed in Android, but you can try this in click event,
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setDataAndType(Uri.parse("file:///sdcard/ECG/12345.pdf"), "application/pdf");
startActivity(intent);
Upvotes: 1
Reputation: 1006809
First, on Android 4.4+, no app has arbitrary access to removable storage. This should include Chrome.
Second, your path will be wrong on most devices. The actual path to removable storage varies by device and manufacturer.
Upvotes: 1