I want to test the behaviour of the mediaplayer I have implemented. This one doesn't read a stream from internet so I downloaded a mp4 video to test. But I cannot access my windows hard drive when using Environment.getExternalStorageDirectory(). The command Environment.getExternalStorageDirectory().getAbsolutePath() gives me /storage/sdcard. So here is my question : how to access windows hard drive from android emulator ? And is it possible ?
As far as I know, it is impossible.
You can not access windows hard drive from android emulator directly.
Instead, If you are familiar with client-server programming, you can access localhost(10.0.2.2).
For now, if you want to load your mp4 file, push that file to emulator sdcard using DDMS.
Inside Eclipse, window->Open perspective->DDMS.
There you have a file explorer (if not seen, window->show view-> file explorer)
Navigate to your sdcard (/storage/sdcard in your case)
On top-right of the explorer, there are buttons for push/pull/remove files
Related
I'm using the react-native-camera module in order to record video. After it records it gives me the uri of the location of the .mp4 video as:
file:///data/user/0/com.cassette_code/cache/Camera/a608b09c-e572-4056-9927-c0e8988cd254.mp4
I don't know where this is located. I recorded this on an android phone. Could someone tell me where I can access it, or if I can specify the location where the video should be stored in my project directory? I looked through the phone's storage, but I don't see com.cassette_code. I'm running it through my phone using USB debugging, so that might be why. But where would it be?
open your file manager in your android phone then select internal storage then android file then data file and finally select your app file
You may have to install something like ES File Explorer, then find the file using that app. Most built in file browsers can't see the application files
I am trying to figure out where the Android emulator's external storage (/sdcard/Music/ for now, but of course I want to find the other external storage locations too) maps to in my Mac's file system. I want to copy some music files over for testing a simple music playing test app.
Tried to use Device File Explorer to figure it out, but there doesn't seem to be an option for that (unlike the resource folders, which have a "reveal in Finder" right click option). Also tried the virtual device configuration options panel but didn't see it there either. Probably overlooking something obvious, so I apologize in advance. Thanks a lot.
It can probably be found somewhere, but since its content can be encrypted, it would be very inconvenient to work with.
The easiest way to upload a file is to right-click on its folder in Device File Explorer and select Upload...
You can also do it with the adb push <local-path> <remote-path> command line tool if you prefer.
I am trying out a test application on an Android emulator. I would like the app to write data to a file that is stored on my C drive. I have read and written data off Samba drives and webservices, but reading and writing to my local hard seems to be a puzzle. I tried filePath = "file:///C:/test/input/"; to point it as my parent folder, but the Emulator doesn't seem to recognize the directory, and I get a 'not found' error.
Any ideas will be appreciated. Thanks.
I would like the app to write data to a file that is stored on my C drive.
That is not possible, unless that file is accessible via some server. The Android SDK emulator does not have access to the filesystem of the developer PC.
Given that you are using an android emulator I am guessing it is setting up some special folder to act as a proxy for the androids hard drive. Meaning that the android emulator doesn't understand what your C drive is and instead is looking in it's 'hard drive' for a file. Find out where the emulator puts files for android, it could be a temp folder, and store your file there.
Edit: Where is Android Emulator Internal Storage this question should help you find where the files should be stored and the naming conventions.
If you don't care using genymotion emulator instead you can refer to this answer, pointing to this post, it has just what you need
I have been using genymoton for quite some time now.
Could someone pls. tell me if there is a way by which I can access the files present in the sd card of genymotion emulator?
Currently I have to upload them to google driver and then download on windows.
You can use shared folder for that. It is well explain on this Google+ post.
Here is the brief:
Go to your VirtualBox VM setting / Shared folder tab
Add a shared folder with the folder you want to shared, and check the "auto mount" option
Start your VM as usual from the Genymotion software
Your shared folder is available in the /mnt/shared directory (multiple shared folders are supported)
This is also possible using the Android Device Monitor.
You already have this if you have the Android SDK installed.
This method works for all connected devices, including emulators like genymotion.
In Android Studio, click the icon that says Android Device Monitor in the toolbar.
(This is also available from Eclipse or you can just type monitor in the command line after moving to the tools folder of your installed sdk)
In the Android Device Monitor, go to the File Explorer tab.
Make sure you have a device selected on the left side.
Find the desired file and select it.
For the sdCard you might need to open the storage folder and open the sdcard there.
Click the button on top that says "Pull a file from the device".
Make sure you select Pull, not Push. Unless if you want to put new files on your device ofcourse.
Save the file to your computer...
and voila! The file from your genymotion is now among your other files on your computer. Ready to be used however you like.
Or alternatively you can also use a third party app like airdroid or any advanced file explorer to exchange files between your device and your computer.
(For installing third party apps you either need to find the apk or flash gapps on your genymotion first and go to the play store.)
Another way that I adopted, just install EsFileEx on genymotion.
Grab your files that you want to copy from e.g
/sdcard/WhatsApp/media/dp.jpeg
Swipe to LAN, here you can see your local machine as 10.0.3.2 or any IP. Here you can access your shared folder/drive of local machine/PC, past copied file here and you done!
NOTE! R/W permission should be set on shared folder/drive of local machine/PC
You can use the eclipse with the ADT plugin and browse the file system like any other android virtual emulators. I have been using this for a while, but eclipse crashes at some times.
Using the emulator, with external storage attached, I would like to emulate what happens when the application starts up and certain files are already present in the relevant directory on ext storage.
Is the external storage actually located on my machine, after enabling it in the AVD? Or should I be creating the files with some temporary, throw away code? Or should I just test on a real device?
What is best practice for this scenario?
The sdcard.img is in the avd folder (~/.android/avd). If you are using Linux or OSX you can mount it, manipulate the files inside, and unmount it.
Probably there's a program in Windows that let you do the same.
As an alternative, you can start the emulator and then manipulate the sdcard content using adb push/pull or DDMS.
The easiest way of creating the SDCard contents, would be to create the files that you need on your machine and then using the DDMS Perspective in Eclipse you can select your emulator in the Devices panel on the left, and then choose the FileExplorer tab on the right. There is a folder named sdcard which contains the SDCard contents.
By using the controlls on the right upper-side you can create folders inside the SDCard and by you can also Push files on the emulators SDCard.
As #dtmilano said, you can also achieve the same thing using Command Prompt.