Ask / Submit
2

backup sms in android phone [answered]

asked 2017-12-10 01:10:15 +0300

Nick gravatar image

hello to all sailors. help me. I tried to follow the guide for backing up the already existing sms. but I can not save text messages in an android phone. I ask you for help. Being that now my jolla fist edition is abandoning me ... before losing all my data I would like to pass them on android. can you help me with this step? from jolla sms to android sms? Thank you very much. thank you.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by nthn
close date 2018-02-02 18:25:51.545216

2 Answers

Sort by » oldest newest most voted
3

answered 2017-12-11 08:14:33 +0300

dreamer gravatar image

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/&/\&amp;/g' | sed 's/\"/\&quot;/g'`
        firstLine=false
    else
        # append the next line
        message="${message}&#10;${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.

edit flag offensive delete publish link more

Comments

Thanks a lot for the answer. as soon as I find the time after work, I try. can I bother you if I have problems? Thanks in advance. hello dreamer

p.s. I had tried that guide but I could not back up. now I try again. Thanks again.

Nick ( 2017-12-11 22:25:09 +0300 )edit

@Nick change the permission of script file before running the script file(sms.sh).You need to log in as a root(develop-su) for changing the permission(chmod 755) of script file.But exit the develp-su before running the script file.Above script file worked for me for SMS backup..

dreamer ( 2017-12-14 16:42:08 +0300 )edit

It worked though i dont use Android SMS, can you describe the App and.provide a link to the SMS app you are referring to?

DarkTuring ( 2017-12-14 17:56:25 +0300 )edit

@dreamer Do you have a similar script to import SMS backup created in "SMS Backup & Restore" in Sailfish OS?

mcencora ( 2018-01-31 16:04:46 +0300 )edit

Worked really well. Thank you.

Tuokki ( 2018-05-04 00:12:17 +0300 )edit
2

answered 2017-12-13 23:03:40 +0300

Nick gravatar image

hi dreamer. i have a problem. image my jolla error

the terminal gives me an error. permission denied after doing: - cd / home / nemo / documents - chmod 755 sms-backuo.sh - cat sms-backup.sh | col -b> sms-b.sh - ./sms-b.sh

I can not continue ... help me please. I attached the image of the error (it is in Italian)

thanks a lot.

edit flag offensive delete publish link more

Comments

1

@Nick Doing chmod +x sms-b.sh before running the script will probably help you :)

ced117 ( 2017-12-14 00:41:44 +0300 )edit

Question tools

Follow
2 followers

Stats

Asked: 2017-12-10 01:10:15 +0300

Seen: 804 times

Last updated: Feb 01 '18