[Samsung Gear 2] mpogr:
Text message templates fun

As I mentioned in one of my earlier posts, there are 3 methods of sending text messages from Gear 2 / Neo:

Text templates

Emoticons

S Voice

Unfortunately, S Voice route is closed for us non-Samsung folk, as it requires compatible Messaging app. But the first two options work.

However, we're also out of luck if we want to change the predefined text templates (there are 6 of these: "How's it going?", "What's up?", "I'll talk to you soon.", "I'll call you later", "Yes", "OK" and "No"). When you hit "Edit text templates", the app crashes, sometimes showing a glimpse of these texts for a short instant.

I suspected these texts have been residing somewhere on the filesystem. It turned out they're in "/data/data/com.samsung.accessory.saproviders/databases/messageprovider.db", which is an SQLite database. Should we just give up? Certainly not!

First, let's get the SQLite command line utility. Now, let's pull the file to the PC (I'm using "adb", to which I referred earlier, to communicate between the PC and the phone):

adb pull /data/data/com.samsung.accessory.saproviders/databases/messageprovider.db C:\Temp

Now, let's have a look inside:

>sqlite3 C:\Temp\messageprovider.db
SQLite version 3.8.4.3 2014-04-03 16:53:12
Enter ".help" for usage hints.
sqlite> .tables
android_metadata sms text_template
sqlite>

This is already looking promising! Let's see what's inside text_template:

sqlite> SELECT * FROM text_template;
0|How's it going?|0|0
1|What's up?|1|0
2|I'll talk to you soon.|2|0
3|I'll call you later.|3|0
4|Yes|4|0
5|OK|5|0
6|No|6|0
sqlite>

Looks familiar! Let's add some more:

sqlite> INSERT INTO text_template VALUES ('7','Running late, sorry!','7','0');
sqlite> INSERT INTO text_template VALUES ('8','Will call you back in 5 minutes','8','0');

Now, let's push it back to the phone and see what happens:

sqlite> .exit
>adb push C:\Temp\messageprovider.db /data/data/com.samsung.accessory.saproviders/databases

We need to take care of permissions and owner:

>adb shell
insertcoin@/# cd /data/data/com.samsung.accessory.saproviders/databases
insertcoin@/data/data/com.samsung.accessory.saproviders/databases# ls -al
-rw-rw-rw- root root 24576 2014-05-04 22:36 messageprovider.db
-rw-rw---- u0_a220 u0_a220 16384 2014-05-03 21:58 msg_accessory.db
-rw------- u0_a220 u0_a220 8720 2014-05-03 21:58 msg_accessory.db-journal
-rw-rw---- u0_a220 u0_a220 20480 2014-05-03 21:58 music_provider.db
-rw------- u0_a220 u0_a220 8720 2014-05-03 21:58 music_provider.db-journal
insertcoin@/data/data/com.samsung.accessory.saproviders/databases# chown u0_a220:u0_a220 messageprovider.db
insertcoin@/data/data/com.samsung.accessory.saproviders/databases# chmod 664 messageprovider.db
insertcoin@/data/data/com.samsung.accessory.saproviders/databases# ls -al
-rw-rw---- u0_a220 u0_a220 24576 2014-05-04 22:51 messageprovider.db
-rw------- u0_a220 u0_a220 8720 2014-05-03 21:58 messageprovider.db-journal
-rw-rw---- u0_a220 u0_a220 16384 2014-05-03 21:58 msg_accessory.db
-rw------- u0_a220 u0_a220 8720 2014-05-03 21:58 msg_accessory.db-journal
-rw-rw---- u0_a220 u0_a220 20480 2014-05-03 21:58 music_provider.db
-rw------- u0_a220 u0_a220 8720 2014-05-03 21:58 music_provider.db-journal

We should be ready to go now! Let's make sure the DB is re-read, the easiest way is to let "saproviders" process crash again, e.g. by opening the text template editor (see above).

You can see the result in the attached image. Have fun!

Caution: always backup files before making changes!!!!!