Tuesday, January 17, 2017

applications - retrieving and classifying Notes with time and date of creation


I wrote hundreds of messages in 'Notes' of my smartphone (the system app), and I would like to retrieve them and put them in a CSV file, (or Excel) with one column for the content of the message, and another with time and date of creation of the note. Is it possible?


My device is Huawei Y330-U01


Android 4.2.2



Answer




It is possible (at least in my device) and I've provided a generalized idea using my Mediatek device running Android 4.2.1.


The idea is very simple. Most of the notes apps I tried so far stores the notes inside a .db file located in their personal space under /data. We have to get the relevant .db file(s) and then export it into a .csv file.


For a non-rooted device




  1. Find the package name of your "Notes" app. You can use ADB command by launching the app in the foreground and entering the following ADB command from PC:


    adb shell dumpsys activity | grep mFocused | awk -F 'u[0-9]+ ' '{print($2)}' | cut -d '/' -f 1

    The output shown for my device was:


    com.mediatek.notebook


    It is possible that the aforesaid command may not work for your device, so either you troubleshoot it by yourself, or install an app like OS Monitor → launch your "Notes" app → launch OS Monitor → locate your "Notes" app amongst the processes and tap on it to see the value corresponding to Process.


    Suggested by Izzy -- If all else fails, then try App Browser or Adebar to find package name. I tried the former and it does the job nicely.




  2. Take backup of your "Notes" app by issuing the following ADB command:


    adb backup 

    where is the package name of the app whose backup you want to take. The file will be saved as backup.ab in the directory from where ADB is executed.


    In my case, I ended up with the backup file backup.ab (~1.7KiB) in my Home directory of GNU/Linux using the command:



    adb backup com.mediatek.notebook

    This step is needed because I'm unaware (as a non-root user) of any other way to get my hands on an app's internal files residing in /data.




  3. The .ab file cannot be opened in my PC so I used Android Backup Extractor (see usage in its README.txt) to convert into .tar archive which then can be opened by any archive viewer (like Ark, WinRAR, and so on).


    Some other methods to unpack the .ab file are mentioned here.



  4. Open the converted file (.tar for me) and locate .db file under appsdb<.db>.

  5. Open that .db in an SQL viewer like DB Browser for SQLite. You can then export the file into .csv using File → Export → Table(s) as CSV file.



For a rooted device:



  1. You can either follow all the aforementioned instructions, or copy the .db file(s) from /data/data//databases/<.db> into your PC and proceed with aforesaid step 5.

  2. You may try SQLite Editor to view the database(s) directly on Android if you only intend to see the content of your "Notes" app, since data and creation time probably would be visible in .db file.


We're good to go now!


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...