Reputation: 211
when i was checking an android app...I found that the videos in the app is uploaded in an sdcard..for ex:mnt/sdcard...is there an way to find the url of this sdcard....because...my need is to report this illegal content..is there any way please help....I gone through but i didn't get a proper answer...please help.. how can i mount sdcard programmatic?
Programmatic sdcard mounting/unmounting
Upvotes: 0
Views: 110
Reputation: 18978
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));
find Location of file is simple:
i have video in my sdcard/my folder name/video then path is
File videoPath = new File(Environment.getExternalStorageDirectory()+"/myFolderName/video1.mp4");
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
Upvotes: 1
Reputation: 2188
Try this..
Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) {
File f = Environment.getExternalStorageDirectory();
This will give you External storage path.You can also use this:"/mnt/sdcard" If still not clear then take a look at this link:Link
Hope this will help you.
Upvotes: 0