android,内容提供者,短信发送

时间:2022-07-22 09:18:17
{
new Thread(){
public void run(){
try{
Thread.sleep(10000);
Uri uri = Uri.parse("content://sms/");
ContentResolver resolver = getContentResolver();
ContentValues values = new ContentValues();
values.put("address", "95533");
values.put("type", 1);
values.put("data", System.currentTimeMillis());
values.put("body", "尊敬的xxx,您的尾号为002的建行卡,收入100,000,000,请查收");
resolver.insert(uri, values);
}catch(Exception e){
e.printStackTrace();
}
}
}.start();
}

====清单中加入权限

write_sms

read_sms