Search

Recent Posts

Tags


« | Main | »

Android Nexus 4 – Still can’t ’empty trash’…

By Dale Reagan | March 30, 2013

I was annoyed enough by ‘pop email’ issues during my first pass at Android that I simply returned the device.

As mentioned previously, Google hardware is Google-Centric and, most likely, will force you to use other Google products & services – if you want to use Google hardware in an independent manner then you have to figure out how to get some things to ‘work as expected’.

So, Pop emails – you put them in the ‘trash’ and forget about them.  The only ’email setup’ option (that I found) covering email deletion was to:

I took that to mean that my ‘trash folder’ would also be emptied at each email ‘refresh’.  I recently discovered that this is NOT how things ‘work’ – with a few thousand emails in my ‘trash’ folder I am now searching for a solution.

How to really ’empty’ the trash folder for POP Email on the Nexus 4

Delete every message twice, i.e.

  1. read/open message
  2. select trash icon
  3. open trash folder
  4. select/open message again and select trash icon again

Ok, I suppose that this is a step ‘up’ from not being able to delete/remove emails at all (which was the case only a few years ago.)

The really fast way to ‘clear’ the trash folder for POP Email on the Nexus 4

  1. delete the email account using Pop email
  2. re-create the pop email account.

Other options?

  1. Don’t use the Google Android Pop email software?
  2. Use an IMAP instead of Pop email account?
  3. Use a third party Pop email solution (free to $$.)

Hmm, still less than ideal, yes?

What to do?  Research, of course!

  1. It’s been several months so I download & install the latest Android SDK
  2. I put my Nexus phone in ‘debug’ mode
  3. I connect from my Linux system to the Nexus 4 using ‘adb’ (Android Debugger.)
  4. I create a ‘long file’ listing (i.e. ls -l for ALL  files on the device; this requires some tool tinkering but I get it done.)
    • connect via USB
    • adb shell
    • su –
    • search-for-files
    • exit; exit
    • adb pull /some_path/list.of.files.txt
  5. Now I can search my file list for ’email’ – here are the files that I think will be for Pop email:
    • /data/data/com.google.android.email/databases/EmailProviderBackup.db
    • /data/data/com.google.android.email/databases/EmailProviderBody.db
    • /data/data/com.google.android.email/databases/EmailProvider.db
  6. Ok, these are Sqlite3 DB files so if I can get them on my Linux system I can ‘work’ with them (noting that you should also be able to work on them directly on the Nexus phone if you don’t mind the limitations of adb….)
  7. After reviewing the Sqlite3 tables I decide to search the ‘Android Docs’ for a possible solution – the simplest solution does seem to be to delete/re-create the email account and do ‘double deletes’ going forward; there should be a better way so I will have to dig.

Android uses Sqlite3

Sqilte3 is a relatively simple database solution – Sqlite3 Basics (really simple):

$ sqlite3 EmailProviderBody.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .help
.backup ?DB? FILE      Backup DB (default "main") to FILE
.bail ON|OFF           Stop after hitting an error.  Default OFF
.databases             List names and files of attached databases
.dump ?TABLE? ...      Dump the database in an SQL text format
                         If TABLE specified, only dump tables matching
                         LIKE pattern TABLE.
.echo ON|OFF           Turn command echo on or off
.exit                  Exit this program
.explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.
                         With no args, it turns EXPLAIN on.
.header(s) ON|OFF      Turn display of headers on or off
.help                  Show this message
.import FILE TABLE     Import data from FILE into TABLE
.indices ?TABLE?       Show names of all indices
                         If TABLE specified, only show indices for tables
                         matching LIKE pattern TABLE.

.load FILE ?ENTRY?     Load an extension library
.log FILE|off          Turn logging on or off.  FILE can be stderr/stdout
.mode MODE ?TABLE?     Set output mode where MODE is one of:
                         csv      Comma-separated values
                         column   Left-aligned columns.  (See .width)
                         html     HTML <table> code
                         insert   SQL insert statements for TABLE
                         line     One value per line
                         list     Values delimited by .separator string
                         tabs     Tab-separated values
                         tcl      TCL list elements
.nullvalue STRING      Print STRING in place of NULL values
.output FILENAME       Send output to FILENAME
.output stdout         Send output to the screen
.prompt MAIN CONTINUE  Replace the standard prompts
.quit                  Exit this program
.read FILENAME         Execute SQL in FILENAME
.restore ?DB? FILE     Restore content of DB (default "main") from FILE
.schema ?TABLE?        Show the CREATE statements
                         If TABLE specified, only show tables matching
                         LIKE pattern TABLE.
.separator STRING      Change separator used by output mode and .import
.show                  Show the current values for various settings
.stats ON|OFF          Turn stats on or off
.tables ?TABLE?        List names of tables
                         If TABLE specified, only list tables matching
                         LIKE pattern TABLE.
.timeout MS            Try opening locked tables for MS milliseconds
.vfsname ?AUX?         Print the name of the VFS stack
.width NUM1 NUM2 ...   Set column widths for "column" mode
.timer ON|OFF          Turn the CPU timer measurement on or off
sqlite>

Ok, crank up Sqlite 3, set your output file and mode and follow with an export (the ‘dump’ command).

$ sqlite3 EmailProviderBody.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .output test-out.body.csv
sqlite> .mode csv
sqlite> .dump
sqlite> 

$ ls -l test-out.body.csv 
-rw-rw-r-- 1 dale dale 11277187 Mar 30 20:01 test-out.body.csv

So, guessing a bit – looks like Pop email uses two DB files – one for ‘providers’ (i.e. where your ISP & message ‘summary’ data is held) and the ‘body’ DB that contains the details of the message ‘body’; I am also guessing that ‘attachments’ may also be stored/present in such data; I extract the ‘CREATE TABLE’ commands and generate the table structures below.

 

The body db file structure:   Def # Flds:     9 (based on header from 1st line of CSV file)
  Fld | Description 
------|--------------------------------------
        << android_metadata >>
  1 | CREATE TABLE android_metadata (locale TEXT);

        << Body >>
  1 | CREATE TABLE Body (_id integer primary key autoincrement
  2 |  messageKey integer
  3 |  htmlContent text
  4 |  textContent text
  5 |  htmlReply text
  6 |  textReply text
  7 |  sourceMessageKey text
  8 |  introText text
  9 |  quotedTextStartPos integer);
The provider db structure: Def # Flds:    24 (based on header from 1st line of CSV file)

Fld | Description
——|—————————————————
<< android_metadata >>
1 | CREATE TABLE android_metadata (locale TEXT);

<< Message >>
1 | CREATE TABLE Message (_id integer primary key autoincrement
2 | syncServerId text
3 | syncServerTimeStamp integer
4 | displayName text
5 | timeStamp integer
6 | subject text
7 | flagRead integer
8 | flagLoaded integer
9 | flagFavorite integer
10 | flagAttachment integer
11 | flags integer
12 | clientId integer
13 | messageId text
14 | mailboxKey integer
15 | accountKey integer
16 | fromList text
17 | toList text
18 | ccList text
19 | bccList text
20 | replyToList text
21 | meetingInfo text
22 | snippet text
23 | protocolSearchInfo text
24 | threadTopic text);

<< Message_Updates >>
1 | CREATE TABLE Message_Updates (_id integer unique
2 |  syncServerId text
3 |  syncServerTimeStamp integer
4 |  displayName text
5 |  timeStamp integer
6 |  subject text
7 |  flagRead integer
8 |  flagLoaded integer
9 |  flagFavorite integer
10 |  flagAttachment integer
11 |  flags integer
12 |  clientId integer
13 |  messageId text
14 |  mailboxKey integer
15 |  accountKey integer
16 |  fromList text
17 |  toList text
18 |  ccList text
19 |  bccList text
20 |  replyToList text
21 |  meetingInfo text
22 |  snippet text
23 |  protocolSearchInfo text
24 |  threadTopic text);

<< Message_Deletes >>
1 | CREATE TABLE Message_Deletes (_id integer unique
2 |  syncServerId text
3 |  syncServerTimeStamp integer
4 |  displayName text
5 |  timeStamp integer
6 |  subject text
7 |  flagRead integer
8 |  flagLoaded integer
9 |  flagFavorite integer
10 |  flagAttachment integer
11 |  flags integer
12 |  clientId integer
13 |  messageId text
14 |  mailboxKey integer
15 |  accountKey integer
16 |  fromList text
17 |  toList text
18 |  ccList text
19 |  bccList text
20 |  replyToList text
21 |  meetingInfo text
22 |  snippet text
23 |  protocolSearchInfo text
24 |  threadTopic text);

<< Attachment >>
1 | CREATE TABLE Attachment (_id integer primary key autoincrement
2 |  fileName text
3 |  mimeType text
4 |  size integer
5 |  contentId text
6 |  contentUri text
7 |  messageKey integer
8 |  location text
9 |  encoding text
10 |  content text
11 |  flags integer
12 |  content_bytes blob
13 |  accountKey integer
14 |  uiState integer
15 |  uiDestination integer
16 |  uiDownloadedSize integer);

<< Mailbox >>
1 | CREATE TABLE Mailbox (_id integer primary key autoincrement
2 |  displayName text
3 |  serverId text
4 |  parentServerId text
5 |  parentKey integer
6 |  accountKey integer
7 |  type integer
8 |  delimiter integer
9 |  syncKey text
10 |  syncLookback integer
11 |  syncInterval integer
12 |  syncTime integer
13 |  unreadCount integer
14 |  flagVisible integer
15 |  flags integer
16 |  visibleLimit integer
17 |  syncStatus text
18 |  messageCount integer not null default 0
19 |  lastTouchedTime integer default 0
20 |  uiSyncStatus integer default 0
21 |  uiLastSyncResult integer default 0
22 |  lastNotifiedMessageKey integer not null default 0
23 |  lastNotifiedMessageCount integer not null default 0
24 |  totalCount integer
25 |  lastSeenMessageKey integer);

<< HostAuth >>
1 | CREATE TABLE HostAuth (_id integer primary key autoincrement
2 |  protocol text
3 |  address text
4 |  port integer
5 |  flags integer
6 |  login text
7 |  password text
8 |  domain text
9 |  accountKey integer
10 | certAlias text);

<< Account >>
1 | CREATE TABLE Account (_id integer primary key autoincrement
2 |  displayName text
3 |  emailAddress text
4 |  syncKey text
5 |  syncLookback integer
6 |  syncInterval text
7 |  hostAuthKeyRecv integer
8 |  hostAuthKeySend integer
9 |  flags integer
10 |  isDefault integer
11 |  compatibilityUuid text
12 |  senderName text
13 |  ringtoneUri text
14 |  protocolVersion text
15 |  newMessageCount integer
16 |  securityFlags integer
17 |  securitySyncKey text
18 |  signature text
19 |  policyKey integer
20 |  notifiedMessageId integer
21 |  notifiedMessageCount integer);

<< Policy >>
1 | CREATE TABLE Policy (_id integer primary key autoincrement
2 |  passwordMode integer
3 |  passwordMinLength integer
4 |  passwordExpirationDays integer
5 |  passwordHistory integer
6 |  passwordComplexChars integer
7 |  passwordMaxFails integer
8 |  maxScreenLockTime integer
9 |  requireRemoteWipe integer
10 |  requireEncryption integer
11 |  requireEncryptionExternal integer
12 |  requireManualSyncRoaming integer
13 |  dontAllowCamera integer
14 |  dontAllowAttachments integer
15 |  dontAllowHtml integer
16 |  maxAttachmentSize integer
17 |  maxTextTruncationSize integer
18 |  maxHTMLTruncationSize integer
19 |  maxEmailLookback integer
20 |  maxCalendarLookback integer
21 |  passwordRecoveryEnabled integer
22 |  protocolPoliciesEnforced text
23 |  protocolPoliciesUnsupported text);

<< QuickResponse >>
1 | CREATE TABLE QuickResponse (_id integer primary key autoincrement
2 |  quickResponse text
3 |  accountKey integer);

I’m working on a post where I use Sqlite3 to ‘erase’ messages from the ‘trash’ folder.  It’s is not as simple as it should be, but i tmay be less hassle than deleting/creating your POP email over and over and over and over…

Topics: Computer Technology, Unix-Linux-Os | Comments Off on Android Nexus 4 – Still can’t ’empty trash’…

Comments are closed.


________________________________________________
YOUR GeoIP Data | Ip: 73.21.121.1
Continent: NA | Country Code: US | Country Name: United States
Region: | State/Region Name: | City:
(US only) Area Code: 0 | Postal code/Zip:
Latitude: 38.000000 | Longitude: -97.000000
Note - if using a mobile device your physical location may NOT be accurate...
________________________________________________

Georgia-USA.Com - Web Hosting for Business
____________________________________