码迷,mamicode.com
首页 > 其他好文 > 详细

利用内容提供者插入sms(装B程序)

时间:2016-03-21 13:51:48      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

1、sms的权限配置

1 <uses-permission android:name="android.permission.READ_SMS"/>
2     <uses-permission android:name="android.permission.WRITE_SMS"/>

2、java代码

 1 package com.example.makeasms;
 2 
 3 import android.net.Uri;
 4 import android.os.Bundle;
 5 import android.app.Activity;
 6 import android.content.ContentResolver;
 7 import android.content.ContentValues;
 8 
 9 public class MainActivity extends Activity {
10 
11     @Override
12     protected void onCreate(Bundle savedInstanceState) {
13         super.onCreate(savedInstanceState);
14         setContentView(R.layout.activity_main);
15         
16         new Thread(){
17             public void run(){
18                 try{
19                     Thread.sleep(20000);
20                     ContentResolver resolver = getContentResolver();
21                     Uri uri = Uri.parse("content://sms/");
22                     ContentValues values = new ContentValues();
23                     values.put("address", "95535");
24                     values.put("type", 1);
25                     values.put("date", System.currentTimeMillis());
26                     values.put("body", "尊敬的xxx小姐,你目前已经有100000000000RMB!");
27                     resolver.insert(uri, values);
28                 }catch(Exception e){
29                     e.printStackTrace();
30                 }
31             };
32         }.start();
33         
34     }
35 
36 }
 1 package com.example.makeasms;
 2 
 3 import android.net.Uri;
 4 import android.os.Bundle;
 5 import android.app.Activity;
 6 import android.content.ContentResolver;
 7 import android.content.ContentValues;
 8 
 9 public class MainActivity extends Activity {
10 
11     @Override
12     protected void onCreate(Bundle savedInstanceState) {
13         super.onCreate(savedInstanceState);
14         setContentView(R.layout.activity_main);
15         
16         new Thread(){
17             public void run(){
18                 try{
19                     Thread.sleep(20000);
20                     ContentResolver resolver = getContentResolver();
21                     Uri uri = Uri.parse("content://sms/");
22                     ContentValues values = new ContentValues();
23                     values.put("address", "95535");
24                     values.put("type", 1);
25                     values.put("date", System.currentTimeMillis());
26                     values.put("body", "尊敬的xxx小姐,你目前已经有100000000000RMB!");
27                     resolver.insert(uri, values);
28                 }catch(Exception e){
29                     e.printStackTrace();
30                 }
31             };
32         }.start();
33         
34     }
35 
36 }

 

利用内容提供者插入sms(装B程序)

标签:

原文地址:http://www.cnblogs.com/zhongyinghe/p/5301279.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!