answered
2017-12-11 08:14:33 +0200
For SMS backup follow the instructions given in this link https://together.jolla.com/question/54249/how-to-saving-sms-text-conversations/.
1.First create empty script file in Jolla phone example: SMS.sh and copy below commands to this SMS.sh file
#!/bin/bash
# A script to dump all text messages to stdout
#
# Usage:
# sms-dump-xml
# (or whatever you choose the name the script)
# The database with the SMS messages
sql_database="/home/nemo/.local/share/commhistory/commhistory.db"
# The SQL query to count the messages
# type : Messages are of type 2
sql_count_query="SELECT COUNT(*) FROM Events WHERE type=2;"
# The SQL command to select which messages to retrieve
# remoteUid : The contact's phone number
# direction : The message direction, can be 1 (received) or 2 (sent)
# startTime : When the message was sent (timestamp)
# freeText : The text of the actual message
# isRead : Whether the message is read (1) or not (0)
# type : Messages are of type 2
sql_list_query="SELECT remoteUid, direction, startTime, isRead, freeText FROM Events WHERE type=2;"
# Don't let root run this
if [ $UID -eq 0 ]; then
echo "Do not run as root."
exit 1
fi
# Count the messages
nb_messages=`sqlite3 "$sql_database" "$sql_count_query"`
# Display the XML header
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'
echo '<?xml-stylesheet type="text/xsl" href="sms.xsl"?>'
echo "<smses count=\"$nb_messages\">"
# Get the message data from the phone's database
# Parse each line and print it, nice and pretty
firstLine=true
sqlite3 "$sql_database" "$sql_list_query" | while read line; do
# Check for the desired format...
format=`echo $line | sed -e 's/.*|[12]|[0-9].*|.*/CORRECTFORMAT/'`
if [ "$format" == "CORRECTFORMAT" ]; then
# write sms if it is complete
if [[ ${firstLine} == false ]]; then
echo " <sms protocol=\"0\" address=\"$contactno\" date=\"$timestamp\""\
"type=\"$direction\" subject=\"null\"" "body=\"$message\" toa=\"null\""\
"sc_toa=\"null\" service_center=\"null\" read=\"$read\" status=\"-1\""\
"locked=\"0\" />"
fi
# Get the contact's phone number
contactno=`echo $line | cut -d '|' -f 1`
# Get the message direction
direction=`echo $line | cut -d '|' -f 2`
# Convert the Unix timestamp to a millisecond-based timestamp
unixtime=`echo $line | cut -d '|' -f 3`
timestamp="${unixtime}000"
# Get the read status
read=`echo $line | cut -d '|' -f 4`
# Get the actual text message
message=`echo $line | cut -d '|' -f 5 | sed 's/&/\&/g' | sed 's/\"/\"/g'`
firstLine=false
else
# append the next line
message="${message} ${line}"
fi
done
echo "</smses>"
2.Using terminal change drive to the destination folder containing SMS.sh file.
3.In the terminal type ./SMS.sh >SMS.xml
4.This will create SMS.xml file in the destination folder of SMS.sh.
5.Now in the android phone download this app SMS Backup & Restore.
6.In the android phone copy the SMS.xml file to SMSBackupRestore folder
7.Now open SMS Backup & Restore app in the android phone and restore the SMS using this app.