Android 簡訊的還原

2021-09-08 18:31:25 字數 1389 閱讀 8361

上篇文章講到《android 簡訊的備份》,本文主要實現android 簡訊的還原,即是將一條

布局檔案:

<

relativelayout

xmlns:android

=""xmlns:tools

=""android:layout_width

="match_parent"

android:layout_height

="match_parent"

tools:context

=".mainactivity"

>

<

button

android:onclick

="restoresms"

android:layout_width

="wrap_content"

android:layout_height

="wrap_content"

android:text

="還原一條簡訊"

/>

relativelayout

>

新增**:

package

com.wuyudong.smsrestore;

import

android.net.uri;

import

android.os.bundle;

import

import

android.content.contentresolver;

import

android.content.contentvalues;

import

android.view.menu;

import

android.view.view;

import

android.widget.toast;

public

class mainactivity extends

activity

public

void

restoresms(view view)

}

新增許可權:

<

uses-permission

android:name

="android.permission.read_sms"

/>

<

uses-permission

android:name

="android.permission.write_sms"

/>

執行專案,搞定

簡訊備份與還原

1 domain中smsinfo 資料實體 public class smsinfo public smsinfo string id,string address,string date,int type,string body public string getid public void se...

android傳送簡訊

smsmanager sm smsmanager.getdefault arraylist smss sm.dividemessage content for string string smss parameters destinationaddress 簡訊接收人的 號碼 scaddress 簡...

android傳送簡訊

利用類 smsmanager 傳送資訊,smsmanager 為 smsmanager 乙個預設的例項.smsmanager smsmanager smsmanager.getdefault smsmanager.sendtextmessage destinationaddress,scaddres...