Or download files to the card over the air.
On Feb 9, 11:55 pm, Dave Sparks <davidspa...@android.com> wrote:
> There are 2 ways that the average user is going to add files to the SD
> card:
>
> 1. Remove the SD card from the device, and plug it into a PC or other
> device to transfer files.
>
> 2. UMS mount the SD card over USB.
>
> In both cases, when the SD card is remounted, the MediaScanner will
> run automatically.
>
> The only time the MediaScanner doesn't run automatically is if "adb
> push" method is used. We think only developers will do this because
> they want to use DDMS or other debug tools over ADB channel.
>
> The MEDIA_MOUNTED intent is what triggers the MediaScanner to scan the
> SD card.
>
> On Feb 9, 10:28 pm, Rohan Francis <rohanfranci...@gmail.com> wrote:
>
> > Hi Dave,
>
> > Thanks for the reply!
>
> > I agree. Perhaps, we should not scan the entire phone periodically.
>
> > I was looking into a use-case where the user may add media
> > without the use of any application. In an application, we can use
> > scanFile
> > to let MediaScanner add media to the MediaProvider database but if we
> > add media as in 'adb push', MediaProvider is not updated.
>
> > So I was looking into a way to trigger MediaScanner to rescan the
> > phone.
> > Maybe not periodically but atleast when the user wants it to, because
> > he
> > added media and probably wants the database to get updated.
>
> > Looking into intents, I came across MEDIA_MOUNTED. I seek your opinion
> > on
> > using this intent to trigger MediaScanner to scan the sdcard when the
> > user
> > wants to. Bad idea? Let me know!
>
> > Thanks,
> > Rohan
>
> > On Feb 9, 9:53 pm, Dave Sparks <davidspa...@android.com> wrote:
>
> > > What are you trying to accomplish by scanning a path or the entire
> > > phone periodically? We try to discourage this because it affects
> > > battery life.
>
> > > The correct way to handle a new media file is to send an intent to the
> > > MediaScanner to scan the file immediately after it is created.
>
> > > On Feb 8, 10:41 pm, Rohan Francis <rohanfranci...@gmail.com> wrote:
>
> > > > Hi All,
>
> > > > I need a little help with the MediaScanner service.
>
> > > > I noticed that the MediaScanner service scans both the internal and
> > > > external memory on the phone to catalog all the media files at phone
> > > > bootup (as seen on the emulator).
>
> > > > My question is - is there any way to trigger the MediaScanner service
> > > > to scan a filepath (not a file) where I may have added media recently?
>
> > > > I noticed that android.media.MediaScannerConnection has a method
> > > > 'scanFile' that can be used to scan a file. Perhaps there exists a way
> > > > to scan a path too?
>
> > > > Or can we trigger MediaScanner to scan the entire phone again? Maybe I
> > > > could check for media file periodically?
>
> > > > Thanks!
> > > > Rohan
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---