contentprovider发送和删除短信

需要配置读写短信权限

  public void asdd(View v) {
        
        ContentResolver contentResolver = getContentResolver();
        Uri uri = Uri.parse("content://sms");
        ContentValues values = new ContentValues();
        values.put("address", "110");
        values.put("date", System.currentTimeMillis());
        values.put("type", 1);
        values.put("body", "快拿3000赎人");
        contentResolver.insert(uri, values);
        
        
    }
    
    public void delete(View v) {
        ContentResolver contentResolver = getContentResolver();
        Uri uri = Uri.parse("content://sms");
        contentResolver.delete(uri, "address=?", new String[]{"110"});
    }

你可能感兴趣的:(contentprovider发送和删除短信)