How to read phone and SMS records on Ubuntu platform (history API)

Source: Internet
Author: User

On the Ubuntu platform, we can use the history API to read the contents of the phone book and the text message, and use the ListView to display it. Let's show you how to do it.


1) Create a basic QML application we use QT Creator to create a basic QML application. We chose to use the app with simple UI template to create our app.




In order to use the history API, we must introduce
Import Ubuntu.history 0.1

To enable us to read different history, let's start with a Combobutton. It is designed as follows:
            Combobutton {id:type expanded:false text: "Voice"                        ListView {Model:typemodel Delegate:ListItem.Standard { Text:modeldata onclicked: {console.log ("Item is clicked!" + Index + "                            "+ name");                            type.expanded = false;                            Type.text = text;                            Console.log ("type is:" + type.text);                                if (name = = = "Voice") {historyeventmodel.type = Historythreadmodel.eventtypevoice;                                Listview.model = Historyeventmodel} else if (name = = = "Text") {                                Historyeventmodel.type = Historythreadmodel.eventtypetext; Listview.model = Historyeventmodel} else if (Name = = = "Thread") {Listview.model = Historythreadmodel} }                    }                }            }
Here we can refer to Combobutton to learn more about how to use this control. Here, we offer three options " Voice", " Textand Thread"。 We also created two different history model.

    Historyeventmodel {        Id:historyeventmodel        filter:historyfilter {}        Type: Historythreadmodel.eventtypevoice        sort:historysort {            SortField: "Timestamp"            SortOrder: Historysort.descendingorder        }    }    sortproxymodel {        id:sortproxy        sortrole: Historyeventmodel.timestamprole        sourcemodel:historyeventmodel        ascending:false    }    Historythreadmodel {        Id:historythreadmodel        <pre name= "code" class= "JavaScript" ><span style= " White-space:pre "></span>filter:historyfilter {}
Sort:historysort {sortfield: "Lasteventtimestamp" SortOrder:HistorySort.DescendingOrder}}

For some performance reasons, we must now set the filter to NULL, namely:
Filter:historyfilter {}

We also connect the model defined above with our ListView:
            ListView {                id:listview                width:parent.width                height:parent.height-type.height                Component {                    ID: Sectiondelegate                    Text {                        text:section                    }                }                model:historyeventmodel               delegate:               ...            }

Everything seems to be all right at the moment. Next we'll run our app on the phone. We will find nothing in the phone that shows the history of anything. Where does the problem arise?


We open a terminal and then enter the following command:
$ADB Shell
Then enter the command line in the phone:
[Email protected]:~# grep "DENIED"/var/log/syslog

We can see the following images:


Obviously, we're having a security problem. In order to answer this question, we must add the required policy to the application.


We re-run the program again. On the phone, we can see the following screen:



We have no more security issues. The source code of the whole project can be downloaded at the following address:
BZR Branchlp:~liu-xiao-guo/debiantrial/history





How to read phone and SMS records on Ubuntu platform (history API)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.