Android :: Way To Let App Know Whenever Any Media File Is Inserted Into Sdcard?
Dec 26, 2009Is there any way to let my app know whenever a media file is inserted or deleted from the sdcard.
View 3 RepliesIs there any way to let my app know whenever a media file is inserted or deleted from the sdcard.
View 3 RepliesI've got some code that downloads mp3s remotely over a streaming url connection... This all works fine but my problem is once the file is complete and I pull up the music app it's not there. A reboot of the phone and it now shows up... anyone know how to force this refresh to occur from without my code?
View 3 Replies View RelatedI want to show the list of media files (.mp3, .mp4...etc) available in sdcard. How can I do this?
View 2 Replies View RelatedI am new to android.I am trying to play a video from sdcard. this is the sample code I have used..
public class videoa extends Activity {
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);
// (1) Web
//videoView.setVideoURI(Uri.parse(
//"http://www.bogotobogo.com/Video/sample.3gp"));
//"http://www.bogotobogo.com/Video/sample.mp4"));................Please help me out.
i'm having this issue of not being able write text file into the SDCard. I'm running the program through eclipse on a HTC magic version 2.1. i had the USB cable unplugged before i run the program. It says that the parent directory of file does not exist: data2/ abc.text
View 9 Replies View Relatedi have a game need to network resource.i want download it on the sdcard.how i put the resouce on my sdcard and how can access my file from the sdcard.
View 3 Replies View RelatedI have the file in sdcard: sample.xml I want to read it, so I dont know some code to connect to sdcard in android.
View 6 Replies View RelatedI want to access the XML file from sdcard and i want to parse thar file. How ta access this file and pass it to Parse method?
View 3 Replies View RelatedI have a file which I created and is present in data/data/com.andr.filedemo/files/a.xml. Now I want to parse this file using XML Pull parser. How can we give the path of that file or how we can access that file and then parse that file using XML Pull parser.
View 1 Replies View RelatedI need to create a protected file in android sdcard. I use file.setReadOnly(); bu it is not working. I don't know how to set a file readable, or how to protect an file from deleting, and the best solution would be to set it hidden.
View 7 Replies View RelatedWhen I saved a file or open a dir under sdcard dir, it always complains:"Parent directory of file is not writable: /sdcard/myfile, java.io.IOException: Parent directory of file is not writable" Any idea what's wrong?
View 2 Replies View RelatedI am trying to write mp3 file in OutputStreamWriter.
here is the code...
it can access the file and makes the FileInputStream object but cann't read. it doesn't go in While loop.
I do not know what is cause of failing to create a new file on a sdcard of G1, the code is below:
File temp = File.createTempFile("test", ".temp", Environment.getExternalStorageDirectory()); and the permission of sdcard is: d--rwxr-x.
Also fail if I try using the code below:
File file = new File(Environment.getExternalStorageDirectory (),"media.temp"); file.createNewFile();
Giving out about Parent directory of file is not writable.
My question is how to copy a file from sdcard to /data/misc/wifi directory? I am working on a configuration tool for wiki supporting wpa enterprise. The configured file wpa_supplicant.conf must be put in / data/misc/wifi in order to work. So how can I move the file from sdcard to there? Is there any function calls to request a superuser access?
View 7 Replies View RelatedHow to put file in sdcard using command line I tried by using adb push command but its not working my file is in D:/sample.ogg I had written code...
View 1 Replies View RelatedIs there any apps like media file recovery on PC , for recover any accidently deleted file or media file for android.
GT-P3100
the media provider cleans the media files, if files didn't get read since last two month. does it cleans(delete) the private application media file stored on sdcard, too if didn't get read from last two month? or Appl Private media file does not come under media file?
View 2 Replies View RelatedI created sdcard and mounted it on my emulator , after closing my app , when i try to pull to copy the files (using command:adb pull /sdcard/calc.trace /tmp)i get this error:"remote object /sdcard/calc.trace does not exist".I am listin gdown the commands in sequence.
1)f:>mksdcard 1024 ./myimage
2)f:>emulator -sdcard ./myimage -avd 1
3)(After running my app and exiting the app)adb pull /sdcard/calc.trace /tmp
In my activity i have start/stop method tracing with fiename calc.trace. i am running windows.
I am trying to copy an image to the emulator sd card by: $ adb push ~/Desktop/bullet_ball_ glass_red.png /sdcard /bullet_ball_glass_red.png But I get an error saying: failed to copy '/Users/n179911/Desktop /bullet_ ball_glass_red.png' to '/sdcard/bullet_ball_glass_ red.png': Read-only file system So I tried to go to adb shell to manual change the /sdcard to non read-only, but it still wont let me. $ adb shell # su # chmod 777 /sdcard Unable to chmod /sdcard: Read-only file system #.
View 8 Replies View RelatedI want to move some files from sdcard to /data/data/myapp/files folder, I can use OpenInputFile and OpenOutputFile and write to it, then delete the original one. But it is slow, so, I tried to use oldFile.Rename(newFile), but it always return false. Any idea? The reason I am doing this is to hide some files from my sdcard, so, nobody can see them.
View 3 Replies View RelatedWhen I try to push a 40MB file onto the sdcard adb hangs and the emulator freezes. Is there a file limitation that I am not aware of? I couldn't find anything on this. When I try the same with a smaller file it works without problems. I have configured the sdcard of the emulator device to have a size of 512MB and when I check with adb shell df I see that there is enough space.
View 6 Replies View RelatedI am trying to push 47mb datafile to my sdcard but it showing error message I am working on latest sdk. ."Failed to push sample.sqlite on emulator-5554: timeout" is this size problem?
View 4 Replies View RelatedCan anybody have any idea how to read a binary file which resides in sdcard using Streams, like Inputstream, CountingInputStream or SwappedDataInputStream?I am using these three streams to read a file which is currently in the Resouces folder, but now i want to move that file in sdcard but I cannot change these stream because I have done so much work on it and I cannot roll back my work.i am doing it this way but its giving me FileNotFoundException.
View 1 Replies View RelatedI am trying to push a videofile onto SDCard . But when I opened SDCARD in FIleExplorer the permission of SDCard is not showing read write. How to change SDCard permission to readwrite so that I can push my file into SDCard.
View 1 Replies View RelatedI have push one html page on my sdcard in emulator. how can I see it and can run it as we do in the desktop?
View 7 Replies View RelatedI use latest android sdk 1.6_r1 i launch the emulator(with the avd comes with sdcard ) then using adb push to push some videos and pictures onto sdcard because i cannot insert/eject sdcard on emulator so i reboot it after reboot, Gallery can find my videos and pictures just inserted now i want to push more pictures to sdcard so i reboot it after pushing files to sdcard but now Gallery cannot find the newer files after i check with adb i found the files i pushed in 2nd time all of them are of length 0 , so i think Gallery cannot read these files so my problem is Why the files i push to sdcard have zero size after i launch Gallery?
View 2 Replies View RelatedI have this code:
CODE:...............
On the marked line of file.createNewFile();
I get java.io.IOException: Parent directory of file is not writable: /sdcard/log.db
I have an sdcard installed and I can easily copy files to it. What might be wrong?
Is it possible to access the filesystem of an sdcard image through something like Windows Explorer?
i.e. mount the sdcard as a drive or web folder or something. I have some xml files stored on my sdcard image which I frequently want to edit.
Ideally I would like to be able to edit these files directly using my fave xml editor (either through the filesystem or webdav).But is this possible?
If not, is the only alternative to pull the xml file from the sdcard to the dev machine filesystem, edit and the push it back?
Often your Media scanner can misbehave and eat lot of CPU, Battery un-wantedly.
I had been digging out how to fix it, and here are my solutions. Perhaps try al of them, it would definitely relieve your cpu and battery usage by large. Solution works on any Android version:
Solution 1. Clear media storage data
Settings > applications > Media Storage > clear data, force stop and reboot.
Solution 2. Remove unwanted media files Navigate to /sdcard/DCIM/.thumbnails and delete all files. Repeat for external sd card. On AOSP roms, Android gallery creates too many of thumbnails that later becomes problematic for media scanner.
Solution 3. Analyze and delete excessive media files Find out what files are causing media scanner to go mad. Use any sdcard analyst (I use ES file manager > menu > Sd card analyst) to determine which directory has lots of files/subdirectories inside it. Any directory having >1000 files/folders is an alarmingly high number. Get rid of them (if you can).
Solution 4. Probe and delete bad/damaged media If you're sure you've tried above solutions and still encountering battery drain, its time to dig deeper with developer tools. Pre-requisite: You must be rooted, and have android developer tools (adb) setup. With ADB tools installed, enter shell and acquire su permissions
Code:
adb shell
su
Then run top (linux task manager) to see which process is eating cpu. You can filter top results
Code:
top -grep media
this would give you a result like
Quote:
130|root@n7000:/ # top | grep media
1905 0 10% S 7 23080K 6168K bg media /system/bin/mediaserver
2808 0 40% S 3 3524K 740K media_rw /system/bin/sdcard
2825 0 9% S 19 255832K 43936K bg u0_a5 android.process.media
%age cpu shows media server is eating cpu and needs to be fixed. Run the following command to determine which file is it currently reading
Code:
lsof | grep media_rw
If the media service is stuck at a directory/file for a long time, you know it's a damaged media file, you should get rid of it.
Once you get rid of such files, Its guaranteed media server would finish scanning soon enough.
Solution 5: Format SD cards If nothing works (or you're too lazy of trying solution 4): Take backup and format Internal, external sd card and copy only selective files/folders that you need. Problems would go away for sure.
Solution 6: Disable Media scanner If your Droid is against you and it just won't tame, its time to disable the media scanner. You can do this from adb shell
Code:
pm disable com.android.providers.media/com.android.providers.media.MediaScannerReceiver All Solutions with full detail: Fix Android Media server scanner SDcard CPU, Battery drain
What does that mean do put the file in ROOT of your SDCard?
View 6 Replies View Related