Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Invisible Files on ICS - media scanner thing?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nathan  
View profile  
 More options Aug 13 2012, 2:28 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 13 Aug 2012 11:28:52 -0700 (PDT)
Local: Mon, Aug 13 2012 2:28 pm
Subject: Invisible Files on ICS - media scanner thing?

If I save a file to the external storage on ICS, how soon should I be able
to see it from my computer?
Two or three weeks is what I am seeing.

And what if include a .nomedia file in a folder above this one? Does that
mean I will never ever see it?

Perhaps I missed it, but I am not seeing good documentation about the media
scanner. Nowhere do I see it mentioned that the media scanner scans any non
media files, but that fact has been mentioned in this forum by reputable
individuals.

I see this note in storage options:

Hiding your files from the Media Scanner

Include an empty file named.nomedia in your external files directory (note
the dot prefix in the filename). This will prevent Android's media scanner
from reading your media files and including them in apps like Gallery or
Music.

This note does not say "this will prevent you from seeing any new files
when browsing the storage from your desktop computer". But does it?

I really do want to hide files from showing up in Gallery or Music, and I
certainly don't want to make the media scanner work overtime on my non
media files. But I don't fully understand the consequences of having a
.nomedia file, or any other reason why these files would be invisible.  

Nathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan  
View profile  
 More options Aug 13 2012, 4:55 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 13 Aug 2012 13:55:54 -0700 (PDT)
Local: Mon, Aug 13 2012 4:55 pm
Subject: Re: Invisible Files on ICS - media scanner thing?

Has anyone else seen this behavior? It is 100 percent reproducible. I write
a file using a FileOutputStream.
I use a file explorer on the device and I see the file. It has 9 files in
the folder.
I browse the folder from My Computer where it says "Galaxy Nexus". The same
folder has 8 files. The file in question is not there.

What is happening?

Nathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Aug 13 2012, 5:03 pm
From: Mark Murphy <mmur...@commonsware.com>
Date: Mon, 13 Aug 2012 17:03:07 -0400
Local: Mon, Aug 13 2012 5:03 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

>> If I save a file to the external storage on ICS, how soon should I be able
>> to see it from my computer?

On a reboot, or once you run the MediaScannerConnection:

http://commonsware.com/blog/2011/08/31/mtp-external-storage.html

Also, it may be tied somewhat to your MTP client -- I don't know if
all of them will auto-refresh when the MTP server information changes.

>> And what if include a .nomedia file in a folder above this one? Does that
>> mean I will never ever see it?

Haven't played with that scenario, sorry.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.0 Available!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kostya Vasilyev  
View profile  
 More options Aug 13 2012, 5:02 pm
From: Kostya Vasilyev <kmans...@gmail.com>
Date: Tue, 14 Aug 2012 01:02:48 +0400
Local: Mon, Aug 13 2012 5:02 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

You are supposed to tell the media scanner about the new file yourself, or
else it might only be scanned after the next reboot.
14.08.2012 0:56 пользователь "Nathan" <nathan.d.mel...@gmail.com> написал:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan  
View profile  
 More options Aug 13 2012, 5:24 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 13 Aug 2012 14:24:32 -0700 (PDT)
Local: Mon, Aug 13 2012 5:24 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

On Monday, August 13, 2012 2:02:48 PM UTC-7, Kostya Vasilyev wrote:

> You are supposed to tell the media scanner about the new file yourself, or
> else it might only be scanned after the next reboot.

How? Any example code to do that? I didn't know I would be interested in
the media apis until now.

And does the .nomedia file matter?

Nathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan  
View profile  
 More options Aug 13 2012, 5:34 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 13 Aug 2012 14:34:36 -0700 (PDT)
Local: Mon, Aug 13 2012 5:34 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

On Monday, August 13, 2012 2:03:07 PM UTC-7, Mark Murphy (a Commons Guy)
wrote:

> Also, it may be tied somewhat to your MTP client -- I don't know if
> all of them will auto-refresh when the MTP server information changes.

Windows Vista is the client - I don't know what it does.

Nathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kostya Vasilyev  
View profile  
 More options Aug 13 2012, 6:18 pm
From: Kostya Vasilyev <kmans...@gmail.com>
Date: Tue, 14 Aug 2012 02:18:14 +0400
Local: Mon, Aug 13 2012 6:18 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

2012/8/14 Nathan <nathan.d.mel...@gmail.com>

> On Monday, August 13, 2012 2:02:48 PM UTC-7, Kostya Vasilyev wrote:

>> You are supposed to tell the media scanner about the new file yourself,
>> or else it might only be scanned after the next reboot.

> How? Any example code to do that? I didn't know I would be interested in
> the media apis until now.

The media scanner has a utility class in the framework:

http://developer.android.com/reference/android/media/MediaScannerConn...

The easiest thing you can do is to call static
MediaScannerConnection.scanFile.

If you need to know when the scanning completes, you can implement
MediaScannerConnection, call connect, then call scanFile...

I have to say that making apps responsible for keeping the OS's data
structures up to date is quite a novel idea -- I guess it's due to the
limitations of the Linux kernel's file system change watching
capability.... AFAIK, it can't watch changes in sub-directories, so setting
a trigger on /mnt/sdcard in some system service won't work...

So -- you gotta do whatcha gotta do :)

> And does the .nomedia file matter?

According to the docs, it makes the media scanner ignore the directory. Not
sure if it has an effect on the scans you initiate yourself...

-- K


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan  
View profile  
 More options Aug 13 2012, 6:43 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 13 Aug 2012 15:43:01 -0700 (PDT)
Local: Mon, Aug 13 2012 6:43 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

On Monday, August 13, 2012 3:18:14 PM UTC-7, Kostya Vasilyev wrote:

> The media scanner has a utility class in the framework:

> http://developer.android.com/reference/android/media/MediaScannerConn...

> The easiest thing you can do is to call static
> MediaScannerConnection.scanFile.

Well, that requires API 8.

Could I call

MediaScannerConnection  conn = new MediaScannerConnection(this,null);
conn.scanfile(filepath,mimetype);

That appears to work all the way back to API 1 - but is that too easy?

> If you need to know when the scanning completes, you can implement
> MediaScannerConnection, call connect, then call scanFile...

Not as curious about that.  

> I have to say that making apps responsible for keeping the OS's data
> structures up to date is quite a novel idea

I think it is silly too - but not your fault.

> And does the .nomedia file matter?

> According to the docs, it makes the media scanner ignore the directory.
> Not sure if it has an effect on the scans you initiate yourself...

So that is still a maybe. The documentation says that *media applications*
ignore the directory. It doesn't say if the media scanner, which now scans
all files, ignores it too. File explorer apps don't appear to ignore the
path.

Nathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kostya Vasilyev  
View profile  
 More options Aug 13 2012, 6:55 pm
From: Kostya Vasilyev <kmans...@gmail.com>
Date: Tue, 14 Aug 2012 02:55:25 +0400
Local: Mon, Aug 13 2012 6:55 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

2012/8/14 Nathan <nathan.d.mel...@gmail.com>

But you only truly need it for MTP at API 14 and higher.

Or for 2.* in some cases (like getting image files to show up in the
gallery app).

> Could I call

> MediaScannerConnection  conn = new MediaScannerConnection(this,null);
> conn.scanfile(filepath,mimetype);

Not like that.

> That appears to work all the way back to API 1 - but is that too easy?

You need to call connect() first, and only when it's done connecting to the
system service can you call scanFile. Don't forget to call disconnect when
done.

I pasted a bit of code here, hopefully it makes sense:

https://gist.github.com/3344643

>> And does the .nomedia file matter?

>> According to the docs, it makes the media scanner ignore the directory.
>> Not sure if it has an effect on the scans you initiate yourself...

> So that is still a maybe. The documentation says that *media applications*
> ignore the directory. It doesn't say if the media scanner, which now scans
> all files, ignores it too. File explorer apps don't appear to ignore the
> path.

A file manager type app most likely uses plain file system calls.

-- K


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nikolay Elenkov  
View profile  
 More options Aug 13 2012, 9:21 pm
From: Nikolay Elenkov <nikolay.elen...@gmail.com>
Date: Tue, 14 Aug 2012 10:21:29 +0900
Local: Mon, Aug 13 2012 9:21 pm
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

On Tue, Aug 14, 2012 at 7:18 AM, Kostya Vasilyev <kmans...@gmail.com> wrote:

> The media scanner has a utility class in the framework:

> http://developer.android.com/reference/android/media/MediaScannerConn...

> The easiest thing you can do is to call static
> MediaScannerConnection.scanFile.

BTW, this method never closes the connection it opens, so you will get
'leaked service connection' (or some such) warnings in logcat if yo use it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kostya Vasilyev  
View profile  
 More options Aug 14 2012, 3:47 am
From: Kostya Vasilyev <kmans...@gmail.com>
Date: Tue, 14 Aug 2012 11:47:30 +0400
Local: Tues, Aug 14 2012 3:47 am
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

2012/8/14 Nikolay Elenkov <nikolay.elen...@gmail.com>

Hmm, there is a call to mConnection.disconnect in ClientProxy, line 204:

https://android.googlesource.com/platform/frameworks/base/+/refs/head...

Perhaps it was added recently?

It won't trigger if scanning a particular path element doesn't result
in onScanCompleted(), though -- wonder if it can?

-- K


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nikolay Elenkov  
View profile  
 More options Aug 14 2012, 4:30 am
From: Nikolay Elenkov <nikolay.elen...@gmail.com>
Date: Tue, 14 Aug 2012 17:30:00 +0900
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

It's been there at least since GB. Looks like it should get
closed, so it looks like my assumption is (mostly?) wrong.

> It won't trigger if scanning a particular path element doesn't result in
> onScanCompleted(), though -- wonder if it can?

Not sure, but here's one warning I got recently, and I've had reports of this
before. This is for scanning a single file.

Service com.github.andlyticsproject.io.ExportService has leaked
ServiceConnection android.media.MediaScannerConnection@4149279 that
was originally bound here
android.app.ServiceConnectionLeaked: Service
com.github.andlyticsproject.io.ExportService has leaked
ServiceConnection android.media.MediaScannerConnection@4149279 that
was originally bound here
at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:965)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:859)
at android.app.ContextImpl.bindService(ContextImpl.java:1216)
at android.app.ContextImpl.bindService(ContextImpl.java:1208)
at android.content.ContextWrapper.bindService(ContextWrapper.java:394)
at android.media.MediaScannerConnection.connect(MediaScannerConnection.java:11 6)
at android.media.MediaScannerConnection.scanFile(MediaScannerConnection.java:2 35)
at com.github.andlyticsproject.io.MediaScannerWrapper.scanFile(MediaScannerWra pper.java:15)
at com.github.andlyticsproject.util.Utils.scanFile(Utils.java:81)
at com.github.andlyticsproject.io.ExportService.exportStats(ExportService.java :102)
at com.github.andlyticsproject.io.ExportService.onHandleIntent(ExportService.j ava:71)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:6 5)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kostya Vasilyev  
View profile  
 More options Aug 14 2012, 4:56 am
From: Kostya Vasilyev <kmans...@gmail.com>
Date: Tue, 14 Aug 2012 12:56:35 +0400
Local: Tues, Aug 14 2012 4:56 am
Subject: Re: [android-developers] Re: Invisible Files on ICS - media scanner thing?

2012/8/14 Nikolay Elenkov <nikolay.elen...@gmail.com>

Funny. When in doubt, trust the logs, ignore the code, I guess :)

-- K


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
3c  
View profile  
 More options Feb 10, 9:59 pm
From: 3c <ccouno...@gmail.com>
Date: Sun, 10 Feb 2013 18:59:18 -0800 (PST)
Local: Sun, Feb 10 2013 9:59 pm
Subject: Re: Invisible Files on ICS - media scanner thing?

I have developed a file explorer (Android Tuner if you want to test this)
and got report that file moved/copied did not appear in gallery or other
apps, (starting with ICS I think).

So I added the scanning/deleting of all files manipulated by the file
explorer, so that they would also appear in MTP on my computer.
But now, Gallery gets updated no matter what, as explained in this issue:
http://code.google.com/p/android/issues/detail?id=24162

Obviously the ".nomedia" is no longer working as it should. Media scanner
is now registering all files on storage (for MTP purposes), but forget to
remove the nomedia content from the media section. A media DB containing
non media files, is this a joke?

I personally find very odd to leave apps responsible for updating OS data
structure. And again, dev will take the blame for one more bug in the OS,
because there's no win-win here for us: either we scan all content and
gallery apps get messed up, or we don't and MTP get messed up!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic