[Verizon HTC One (M8)] xdadevelopers-user:
I have not tried any 3rd party galleries. Suggestions?

The card is formatted vfat (fat32?).

I've been tinkering around the the databases in /data/data/com.android.providers.media/databases. There is a file called external.db and another called internal.db.

The external db has a log table that contains entries like this:

2015-03-15 00:52:33.272|Database upgraded from version 63 to 707 in 0 seconds
2015-03-15 00:52:33.354|Database migrated htc sense to sense70
2015-03-15 00:53:18.141|removed 0 rows from files for data backup
2015-03-15 00:56:23.367|external.db: version 707, 11173 rows, 11173 inserts, 11971 updates, 2 deletes, 1085 queries, scan started Mar 14, 6:54 PM (01:51)
2015-03-15 00:56:53.987|external.db: version 707, 12670 rows, 12673 inserts, 12829 updates, 4 deletes, 1718 queries, scan started Mar 14, 6:56 PM (00:14)
2015-03-15 00:57:23.168|external.db: version 707, 12670 rows, 12673 inserts, 12838 updates, 6 deletes, 1756 queries, scan started Mar 14, 6:57 PM (00:08)
2015-03-15 00:57:23.372|removed 0 rows from files for data backup
2015-03-16 03:23:21.625|external.db: version 707, 12679 rows, 4 inserts, 162 updates, 2 deletes, 41 queries, scan started Mar 15, 9:22 PM (00:50)
2015-03-16 03:25:15.542|external.db: version 707, 12679 rows, 4 inserts, 264 updates, 4 deletes, 185 queries, scan started Mar 15, 9:23 PM (01:53)
2015-03-16 03:25:16.086|removed 1 rows from files for data backup
2015-03-16 18:34:41.847|external.db: version 707, 12681 rows, 3 inserts, 158 updates, 2 deletes, 58 queries, scan started Mar 16, 12:33 PM (01:26)
2015-03-16 18:36:49.137|external.db: version 707, 12681 rows, 3 inserts, 260 updates, 4 deletes, 221 queries, scan started Mar 16, 12:35 PM (00:50)
2015-03-16 18:36:49.315|removed 0 rows from files for data backup
2015-03-16 19:33:56.076|external.db: version 707, 12681 rows, 0 inserts, 134 updates, 2 deletes, 59 queries, scan started Mar 16, 1:33 PM (00:50)
2015-03-16 19:34:49.877|external.db: version 707, 12681 rows, 0 inserts, 236 updates, 4 deletes, 177 queries, scan started Mar 16, 1:33 PM (00:53)
2015-03-16 19:34:50.067|removed 0 rows from files for data backup

The 'images' table is empty. The 'files' table has 12,681 entries. These entries in the files include the images I want to see in gallery.

Taking a picture adds an entry into the 'files' table. Taking lots of pictures adds lots of entries. Clearing data on gallery doesn't make them go away. Clearing data on 'Media Storage' does; and they never come back.

Surely I'm not the only one who is not seeing the pictures on my external SD card being displayed in gallery? Is there anyone who can confirm that they DO see pictures on the external SD card in gallery?

Thanks,

-xdadevelopers-user

UPDATE2 - Fixed again - the right way.

Sorry. I'm an idiot. It turns out that somehow my external SD card had .nomedia files all over the place. As you may or may not know (and as I had conveniently forgotten) the presence of this file in a directory tells the media scanner to not add files in the same directory to the various media collections (audio, video, playlists, etc.). So, all the while it was working exactly as it should. I removed the .nomedia files and cleared data on 'Media Storage' and now it properly inventories ALL the files on the external SD card.

My apologies to anyone whose time I may have wasted.

UPDATE - Fixed - the wrong way:

I found that the files were being added to the 'files' table in the external.db but the 'images' view had nothing in it. Checking the 'images' view I see that it's basically pulling anything in 'files' that has a media_type of 1. None of the inventoried files were added with media_type 1. They were all 0.

So, I updated all the image files in the 'files' table to have media_type 1. Before I could do this I had to drop the trigger 'files_v_folder_updated'.

So here are the steps I took in case anyone else runs into the same thing and wants to try and fix it themselves. This was all run on the phone from an adb shell.

# sqlite3 /data/data/com.android.providers.media/databases/external.db
sqlite> drop trigger files_v_folder_updated;
sqlite> update files setup media_type=1 where mime_type like 'image%';
sqlite> CREATE TRIGGER files_v_folder_updated update ON files WHEN old._data != new._data BEGING SELECT _DATA_CHANGED(old._id, old._data, new._data);END;
sqlite> .quit

After doing this gallery now shows ALL of the images on my external SD card. I still don't understand why the media scanner found and added these existing images without the media_type set correctly.

-xdadevelopers-user