android 短信 彩信 数据库

android 短信 彩信 数据库

转自:http://gnibre.javaeye.com/blog/558031

 

短信 sms
文件 /data/data/com.android.providers.telephony/databases/mmssms.db
这个数据库有13张表,sms表存了短信信息。

sms表的uri是

Java代码
  1. public   static   final  Uri CONTENT_URI =  
  2.             Uri.parse("content://sms" );  
public static final Uri CONTENT_URI =
            Uri.parse("content://sms");


表项含义,我猜的
0 _id
1 thread_id   在短信界面里显示在第几组( 相同联系人的短信在同意行),英文名叫话题。
2 address   电话好吗
3 person   ? 存在电话簿里的名字 。 可能吧
4 date      日期
5 protocol  ?..
6 read      ?  1- 已读  0-未读 
7 status    ?
8 type      ? 2 我发送
9 reply_path_present   ?
10 subject
11 body      短信内容
12  service_center   ...

好没信息量。。。。

把源码补上。
在frameworks/base/core/java/android/provider/Telephony.java

Java代码
  1. /**  
  2.   * The thread ID of the message  
  3.   * <P>Type: INTEGER</P>  
  4.   */   
  5.  public   static   final  String THREAD_ID =  "thread_id" ;  
  6.   
  7.  /**  
  8.   * The address of the other party  
  9.   * <P>Type: TEXT</P>  
  10.   */   
  11.  public   static   final  String ADDRESS =  "address" ;  
  12.   
  13.  /**  
  14.   * The person ID of the sender  
  15.   * <P>Type: INTEGER (long)</P>  
  16.   */   
  17.  public   static   final  String PERSON_ID =  "person" ;  
  18.   
  19.  /**  
  20.   * The date the message was sent  
  21.   * <P>Type: INTEGER (long)</P>  
  22.   */   
  23.  public   static   final  String DATE =  "date" ;  
  24.   
  25.  /**  
  26.   * The protocol identifier code  
  27.   * <P>Type: INTEGER</P>  
  28.   */   
  29.  public   static   final  String PROTOCOL =  "protocol" ;  
  30.   
  31.  /**  
  32.   * Has the message been read  
  33.   * <P>Type: INTEGER (boolean)</P>  
  34.   */   
  35.  public   static   final  String READ =  "read" ;  
  36.   
  37.   
  38.  /**  
  39.   * The TP-Status value for the message, or -1 if no status has  
  40.   * been received  
  41.   */   
  42.  public   static   final  String STATUS =  "status" ;  
  43. us 举例:  
  44.  public   static   final   int  STATUS_NONE = - 1 ;  
  45.  public   static   final   int  STATUS_COMPLETE =  0 ;  
  46.  public   static   final   int  STATUS_PENDING =  64 ;  
  47.  public   static   final   int  STATUS_FAILED =  128 ;  
  48.   
  49. /**  
  50.   * The type of the message  
  51.   * <P>Type: INTEGER</P>  
  52.   */   
  53.  public   static   final  String TYPE =  "type" ;  
  54.  举例  
  55.  public   static   final   int  MESSAGE_TYPE_ALL    =  0 ;  
  56.  public   static   final   int  MESSAGE_TYPE_INBOX  =  1 ;  
  57.  public   static   final   int  MESSAGE_TYPE_SENT   =  2 ;  
  58.  public   static   final   int  MESSAGE_TYPE_DRAFT  =  3 ;  
  59.  public   static   final   int  MESSAGE_TYPE_OUTBOX =  4 ;  
  60.  public   static   final   int  MESSAGE_TYPE_FAILED =  5// for failed outgoing messages   
  61.  public   static   final   int  MESSAGE_TYPE_QUEUED =  6// for messages to send later   
  62.   
  63.   
  64.  /**  
  65.   * Whether the <code>TP-Reply-Path</code> bit was set on this message  
  66.   * <P>Type: BOOLEAN</P>  
  67.   */   
  68.  public   static   final  String REPLY_PATH_PRESENT =  "reply_path_present" ;  
  69.   
  70.  /**  
  71.   * The subject of the message, if present  
  72.   * <P>Type: TEXT</P>  
  73.   */   
  74.  public   static   final  String SUBJECT =  "subject" ;  
  75.   
  76.   
  77.  /**  
  78.   * The body of the message  
  79.   * <P>Type: TEXT</P>  
  80.   */   
  81.  public   static   final  String BODY =  "body" ;  
  82.   
  83.   
  84.  /**  
  85.   * The service center (SC) through which to send the message, if present  
  86.   * <P>Type: TEXT</P>  
  87.   */   
  88.  public   static   final  String SERVICE_CENTER =  "service_center" ;  
  89.   
  90.   
  91.   
  92.  /**  
  93.   * Has the message been locked?  
  94.   * <P>Type: INTEGER (boolean)</P>  
  95.   */   
  96.  public   static   final  String LOCKED =  "locked" ;  
  97.   
  98. **  
  99.   * The id of the sender of the conversation, if  present  
  100.   * <P>Type: INTEGER (reference to item in content://contacts/people)</P>   
  101.   */  
  102.  public   static   final  String PERSON =  "person" ;  
       /**
         * The thread ID of the message
         * <P>Type: INTEGER</P>
         */
        public static final String THREAD_ID = "thread_id";

        /**
         * The address of the other party
         * <P>Type: TEXT</P>
         */
        public static final String ADDRESS = "address";

        /**
         * The person ID of the sender
         * <P>Type: INTEGER (long)</P>
         */
        public static final String PERSON_ID = "person";

        /**
         * The date the message was sent
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE = "date";

        /**
         * The protocol identifier code
         * <P>Type: INTEGER</P>
         */
        public static final String PROTOCOL = "protocol";

        /**
         * Has the message been read
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String READ = "read";


        /**
         * The TP-Status value for the message, or -1 if no status has
         * been received
         */
        public static final String STATUS = "status";
// status 举例:
        public static final int STATUS_NONE = -1;
        public static final int STATUS_COMPLETE = 0;
        public static final int STATUS_PENDING = 64;
        public static final int STATUS_FAILED = 128;

       /**
         * The type of the message
         * <P>Type: INTEGER</P>
         */
        public static final String TYPE = "type";
// type 举例
        public static final int MESSAGE_TYPE_ALL    = 0;
        public static final int MESSAGE_TYPE_INBOX  = 1;
        public static final int MESSAGE_TYPE_SENT   = 2;
        public static final int MESSAGE_TYPE_DRAFT  = 3;
        public static final int MESSAGE_TYPE_OUTBOX = 4;
        public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing messages
        public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send later


        /**
         * Whether the <code>TP-Reply-Path</code> bit was set on this message
         * <P>Type: BOOLEAN</P>
         */
        public static final String REPLY_PATH_PRESENT = "reply_path_present";

        /**
         * The subject of the message, if present
         * <P>Type: TEXT</P>
         */
        public static final String SUBJECT = "subject";


        /**
         * The body of the message
         * <P>Type: TEXT</P>
         */
        public static final String BODY = "body";


        /**
         * The service center (SC) through which to send the message, if present
         * <P>Type: TEXT</P>
         */
        public static final String SERVICE_CENTER = "service_center";


// 另外还有
        /**
         * Has the message been locked?
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String LOCKED = "locked";

      /**
         * The id of the sender of the conversation, if present
         * <P>Type: INTEGER (reference to item in content://contacts/people)</P>
         */
        public static final String PERSON = "person";





彩信。

1、pdu表
    mmssms.db库中的pdu表存储了彩信标题、彩信接收时间和彩信ID等信息,其中“_id”是主键,唯一标识了一个条彩信。

pdu 表源码

Java代码
  1. /**  
  2.  * Base columns for tables that contain MMSs.  
  3.  */   
  4. public   interface  BaseMmsColumns  extends  BaseColumns {  
  5.   
  6.     public   static   final   int  MESSAGE_BOX_ALL    =  0 ;  
  7.     public   static   final   int  MESSAGE_BOX_INBOX  =  1 ;  
  8.     public   static   final   int  MESSAGE_BOX_SENT   =  2 ;  
  9.     public   static   final   int  MESSAGE_BOX_DRAFTS =  3 ;  
  10.     public   static   final   int  MESSAGE_BOX_OUTBOX =  4 ;  
  11.   
  12.     /**  
  13.      * The date the message was sent.  
  14.      * <P>Type: INTEGER (long)</P>  
  15.      */   
  16.     public   static   final  String DATE =  "date" ;  
  17.   
  18.     /**  
  19.      * The box which the message belong to, for example, MESSAGE_BOX_INBOX.  
  20.      * <P>Type: INTEGER</P>  
  21.      */   
  22.     public   static   final  String MESSAGE_BOX =  "msg_box" ;  
  23.   
  24.     /**  
  25.      * Has the message been read.  
  26.      * <P>Type: INTEGER (boolean)</P>  
  27.      */   
  28.     public   static   final  String READ =  "read" ;  
  29.   
  30.     /**  
  31.      * The Message-ID of the message.  
  32.      * <P>Type: TEXT</P>  
  33.      */   
  34.     public   static   final  String MESSAGE_ID =  "m_id" ;  
  35.   
  36.     /**  
  37.      * The subject of the message, if present.  
  38.      * <P>Type: TEXT</P>  
  39.      */   
  40.     public   static   final  String SUBJECT =  "sub" ;  
  41.   
  42.     /**  
  43.      * The character set of the subject, if present.  
  44.      * <P>Type: INTEGER</P>  
  45.      */   
  46.     public   static   final  String SUBJECT_CHARSET =  "sub_cs" ;  
  47.   
  48.     /**  
  49.      * The Content-Type of the message.  
  50.      * <P>Type: TEXT</P>  
  51.      */   
  52.     public   static   final  String CONTENT_TYPE =  "ct_t" ;  
  53.   
  54.     /**  
  55.      * The Content-Location of the message.  
  56.      * <P>Type: TEXT</P>  
  57.      */   
  58.     public   static   final  String CONTENT_LOCATION =  "ct_l" ;  
  59.   
  60.     /**  
  61.      * The address of the sender.  
  62.      * <P>Type: TEXT</P>  
  63.      */   
  64.     public   static   final  String FROM =  "from" ;  
  65.   
  66.     /**  
  67.      * The address of the recipients.  
  68.      * <P>Type: TEXT</P>  
  69.      */   
  70.     public   static   final  String TO =  "to" ;  
  71.   
  72.     /**  
  73.      * The address of the cc. recipients.  
  74.      * <P>Type: TEXT</P>  
  75.      */   
  76.     public   static   final  String CC =  "cc" ;  
  77.   
  78.     /**  
  79.      * The address of the bcc. recipients.  
  80.      * <P>Type: TEXT</P>  
  81.      */   
  82.     public   static   final  String BCC =  "bcc" ;  
  83.   
  84.     /**  
  85.      * The expiry time of the message.  
  86.      * <P>Type: INTEGER</P>  
  87.      */   
  88.     public   static   final  String EXPIRY =  "exp" ;  
  89.   
  90.     /**  
  91.      * The class of the message.  
  92.      * <P>Type: TEXT</P>  
  93.      */   
  94.     public   static   final  String MESSAGE_CLASS =  "m_cls" ;  
  95.   
  96.     /**  
  97.      * The type of the message defined by MMS spec.  
  98.      * <P>Type: INTEGER</P>  
  99.      */   
  100.     public   static   final  String MESSAGE_TYPE =  "m_type" ;  
  101.   
  102.     /**  
  103.      * The version of specification that this message conform.  
  104.      * <P>Type: INTEGER</P>  
  105.      */   
  106.     public   static   final  String MMS_VERSION =  "v" ;  
  107.   
  108.     /**  
  109.      * The size of the message.  
  110.      * <P>Type: INTEGER</P>  
  111.      */   
  112.     public   static   final  String MESSAGE_SIZE =  "m_size" ;  
  113.   
  114.     /**  
  115.      * The priority of the message.  
  116.      * <P>Type: TEXT</P>  
  117.      */   
  118.     public   static   final  String PRIORITY =  "pri" ;  
  119.   
  120.     /**  
  121.      * The read-report of the message.  
  122.      * <P>Type: TEXT</P>  
  123.      */   
  124.     public   static   final  String READ_REPORT =  "rr" ;  
  125.   
  126.     /**  
  127.      * Whether the report is allowed.  
  128.      * <P>Type: TEXT</P>  
  129.      */   
  130.     public   static   final  String REPORT_ALLOWED =  "rpt_a" ;  
  131.   
  132.     /**  
  133.      * The response-status of the message.  
  134.      * <P>Type: INTEGER</P>  
  135.      */   
  136.     public   static   final  String RESPONSE_STATUS =  "resp_st" ;  
  137.   
  138.     /**  
  139.      * The status of the message.  
  140.      * <P>Type: INTEGER</P>  
  141.      */   
  142.     public   static   final  String STATUS =  "st" ;  
  143.   
  144.     /**  
  145.      * The transaction-id of the message.  
  146.      * <P>Type: TEXT</P>  
  147.      */   
  148.     public   static   final  String TRANSACTION_ID =  "tr_id" ;  
  149.   
  150.     /**  
  151.      * The retrieve-status of the message.  
  152.      * <P>Type: INTEGER</P>  
  153.      */   
  154.     public   static   final  String RETRIEVE_STATUS =  "retr_st" ;  
  155.   
  156.     /**  
  157.      * The retrieve-text of the message.  
  158.      * <P>Type: TEXT</P>  
  159.      */   
  160.     public   static   final  String RETRIEVE_TEXT =  "retr_txt" ;  
  161.   
  162.     /**  
  163.      * The character set of the retrieve-text.  
  164.      * <P>Type: TEXT</P>  
  165.      */   
  166.     public   static   final  String RETRIEVE_TEXT_CHARSET =  "retr_txt_cs" ;  
  167.   
  168.     /**  
  169.      * The read-status of the message.  
  170.      * <P>Type: INTEGER</P>  
  171.      */   
  172.     public   static   final  String READ_STATUS =  "read_status" ;  
  173.   
  174.     /**  
  175.      * The content-class of the message.  
  176.      * <P>Type: INTEGER</P>  
  177.      */   
  178.     public   static   final  String CONTENT_CLASS =  "ct_cls" ;  
  179.   
  180.     /**  
  181.      * The delivery-report of the message.  
  182.      * <P>Type: INTEGER</P>  
  183.      */   
  184.     public   static   final  String DELIVERY_REPORT =  "d_rpt" ;  
  185.   
  186.     /**  
  187.      * The delivery-time-token of the message.  
  188.      * <P>Type: INTEGER</P>  
  189.      */   
  190.     public   static   final  String DELIVERY_TIME_TOKEN =  "d_tm_tok" ;  
  191.   
  192.     /**  
  193.      * The delivery-time of the message.  
  194.      * <P>Type: INTEGER</P>  
  195.      */   
  196.     public   static   final  String DELIVERY_TIME =  "d_tm" ;  
  197.   
  198.     /**  
  199.      * The response-text of the message.  
  200.      * <P>Type: TEXT</P>  
  201.      */   
  202.     public   static   final  String RESPONSE_TEXT =  "resp_txt" ;  
  203.   
  204.     /**  
  205.      * The sender-visibility of the message.  
  206.      * <P>Type: TEXT</P>  
  207.      */   
  208.     public   static   final  String SENDER_VISIBILITY =  "s_vis" ;  
  209.   
  210.     /**  
  211.      * The reply-charging of the message.  
  212.      * <P>Type: INTEGER</P>  
  213.      */   
  214.     public   static   final  String REPLY_CHARGING =  "r_chg" ;  
  215.   
  216.     /**  
  217.      * The reply-charging-deadline-token of the message.  
  218.      * <P>Type: INTEGER</P>  
  219.      */   
  220.     public   static   final  String REPLY_CHARGING_DEADLINE_TOKEN =  "r_chg_dl_tok" ;  
  221.   
  222.     /**  
  223.      * The reply-charging-deadline of the message.  
  224.      * <P>Type: INTEGER</P>  
  225.      */   
  226.     public   static   final  String REPLY_CHARGING_DEADLINE =  "r_chg_dl" ;  
  227.   
  228.     /**  
  229.      * The reply-charging-id of the message.  
  230.      * <P>Type: TEXT</P>  
  231.      */   
  232.     public   static   final  String REPLY_CHARGING_ID =  "r_chg_id" ;  
  233.   
  234.     /**  
  235.      * The reply-charging-size of the message.  
  236.      * <P>Type: INTEGER</P>  
  237.      */   
  238.     public   static   final  String REPLY_CHARGING_SIZE =  "r_chg_sz" ;  
  239.   
  240.     /**  
  241.      * The previously-sent-by of the message.  
  242.      * <P>Type: TEXT</P>  
  243.      */   
  244.     public   static   final  String PREVIOUSLY_SENT_BY =  "p_s_by" ;  
  245.   
  246.     /**  
  247.      * The previously-sent-date of the message.  
  248.      * <P>Type: INTEGER</P>  
  249.      */   
  250.     public   static   final  String PREVIOUSLY_SENT_DATE =  "p_s_d" ;  
  251.   
  252.     /**  
  253.      * The store of the message.  
  254.      * <P>Type: TEXT</P>  
  255.      */   
  256.     public   static   final  String STORE =  "store" ;  
  257.   
  258.     /**  
  259.      * The mm-state of the message.  
  260.      * <P>Type: INTEGER</P>  
  261.      */   
  262.     public   static   final  String MM_STATE =  "mm_st" ;  
  263.   
  264.     /**  
  265.      * The mm-flags-token of the message.  
  266.      * <P>Type: INTEGER</P>  
  267.      */   
  268.     public   static   final  String MM_FLAGS_TOKEN =  "mm_flg_tok" ;  
  269.   
  270.     /**  
  271.      * The mm-flags of the message.  
  272.      * <P>Type: TEXT</P>  
  273.      */   
  274.     public   static   final  String MM_FLAGS =  "mm_flg" ;  
  275.   
  276.     /**  
  277.      * The store-status of the message.  
  278.      * <P>Type: TEXT</P>  
  279.      */   
  280.     public   static   final  String STORE_STATUS =  "store_st" ;  
  281.   
  282.     /**  
  283.      * The store-status-text of the message.  
  284.      * <P>Type: TEXT</P>  
  285.      */   
  286.     public   static   final  String STORE_STATUS_TEXT =  "store_st_txt" ;  
  287.   
  288.     /**  
  289.      * The stored of the message.  
  290.      * <P>Type: TEXT</P>  
  291.      */   
  292.     public   static   final  String STORED =  "stored" ;  
  293.   
  294.     /**  
  295.      * The totals of the message.  
  296.      * <P>Type: TEXT</P>  
  297.      */   
  298.     public   static   final  String TOTALS =  "totals" ;  
  299.   
  300.     /**  
  301.      * The mbox-totals of the message.  
  302.      * <P>Type: TEXT</P>  
  303.      */   
  304.     public   static   final  String MBOX_TOTALS =  "mb_t" ;  
  305.   
  306.     /**  
  307.      * The mbox-totals-token of the message.  
  308.      * <P>Type: INTEGER</P>  
  309.      */   
  310.     public   static   final  String MBOX_TOTALS_TOKEN =  "mb_t_tok" ;  
  311.   
  312.     /**  
  313.      * The quotas of the message.  
  314.      * <P>Type: TEXT</P>  
  315.      */   
  316.     public   static   final  String QUOTAS =  "qt" ;  
  317.   
  318.     /**  
  319.      * The mbox-quotas of the message.  
  320.      * <P>Type: TEXT</P>  
  321.      */   
  322.     public   static   final  String MBOX_QUOTAS =  "mb_qt" ;  
  323.   
  324.     /**  
  325.      * The mbox-quotas-token of the message.  
  326.      * <P>Type: INTEGER</P>  
  327.      */   
  328.     public   static   final  String MBOX_QUOTAS_TOKEN =  "mb_qt_tok" ;  
  329.   
  330.     /**  
  331.      * The message-count of the message.  
  332.      * <P>Type: INTEGER</P>  
  333.      */   
  334.     public   static   final  String MESSAGE_COUNT =  "m_cnt" ;  
  335.   
  336.     /**  
  337.      * The start of the message.  
  338.      * <P>Type: INTEGER</P>  
  339.      */   
  340.     public   static   final  String START =  "start" ;  
  341.   
  342.     /**  
  343.      * The distribution-indicator of the message.  
  344.      * <P>Type: TEXT</P>  
  345.      */   
  346.     public   static   final  String DISTRIBUTION_INDICATOR =  "d_ind" ;  
  347.   
  348.     /**  
  349.      * The element-descriptor of the message.  
  350.      * <P>Type: TEXT</P>  
  351.      */   
  352.     public   static   final  String ELEMENT_DESCRIPTOR =  "e_des" ;  
  353.   
  354.     /**  
  355.      * The limit of the message.  
  356.      * <P>Type: INTEGER</P>  
  357.      */   
  358.     public   static   final  String LIMIT =  "limit" ;  
  359.   
  360.     /**  
  361.      * The recommended-retrieval-mode of the message.  
  362.      * <P>Type: INTEGER</P>  
  363.      */   
  364.     public   static   final  String RECOMMENDED_RETRIEVAL_MODE =  "r_r_mod" ;  
  365.   
  366.     /**  
  367.      * The recommended-retrieval-mode-text of the message.  
  368.      * <P>Type: TEXT</P>  
  369.      */   
  370.     public   static   final  String RECOMMENDED_RETRIEVAL_MODE_TEXT =  "r_r_mod_txt" ;  
  371.   
  372.     /**  
  373.      * The status-text of the message.  
  374.      * <P>Type: TEXT</P>  
  375.      */   
  376.     public   static   final  String STATUS_TEXT =  "st_txt" ;  
  377.   
  378.     /**  
  379.      * The applic-id of the message.  
  380.      * <P>Type: TEXT</P>  
  381.      */   
  382.     public   static   final  String APPLIC_ID =  "apl_id" ;  
  383.   
  384.     /**  
  385.      * The reply-applic-id of the message.  
  386.      * <P>Type: TEXT</P>  
  387.      */   
  388.     public   static   final  String REPLY_APPLIC_ID =  "r_apl_id" ;  
  389.   
  390.     /**  
  391.      * The aux-applic-id of the message.  
  392.      * <P>Type: TEXT</P>  
  393.      */   
  394.     public   static   final  String AUX_APPLIC_ID =  "aux_apl_id" ;  
  395.   
  396.     /**  
  397.      * The drm-content of the message.  
  398.      * <P>Type: TEXT</P>  
  399.      */   
  400.     public   static   final  String DRM_CONTENT =  "drm_c" ;  
  401.   
  402.     /**  
  403.      * The adaptation-allowed of the message.  
  404.      * <P>Type: TEXT</P>  
  405.      */   
  406.     public   static   final  String ADAPTATION_ALLOWED =  "adp_a" ;  
  407.   
  408.     /**  
  409.      * The replace-id of the message.  
  410.      * <P>Type: TEXT</P>  
  411.      */   
  412.     public   static   final  String REPLACE_ID =  "repl_id" ;  
  413.   
  414.     /**  
  415.      * The cancel-id of the message.  
  416.      * <P>Type: TEXT</P>  
  417.      */   
  418.     public   static   final  String CANCEL_ID =  "cl_id" ;  
  419.   
  420.     /**  
  421.      * The cancel-status of the message.  
  422.      * <P>Type: INTEGER</P>  
  423.      */   
  424.     public   static   final  String CANCEL_STATUS =  "cl_st" ;  
  425.   
  426.     /**  
  427.      * The thread ID of the message  
  428.      * <P>Type: INTEGER</P>  
  429.      */   
  430.     public   static   final  String THREAD_ID =  "thread_id" ;  
  431.   
  432.     /**  
  433.      * Has the message been locked?  
  434.      * <P>Type: INTEGER (boolean)</P>  
  435.      */   
  436.     public   static   final  String LOCKED =  "locked" ;  
  437. }  
    /**
     * Base columns for tables that contain MMSs.
     */
    public interface BaseMmsColumns extends BaseColumns {

        public static final int MESSAGE_BOX_ALL    = 0;
        public static final int MESSAGE_BOX_INBOX  = 1;
        public static final int MESSAGE_BOX_SENT   = 2;
        public static final int MESSAGE_BOX_DRAFTS = 3;
        public static final int MESSAGE_BOX_OUTBOX = 4;

        /**
         * The date the message was sent.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE = "date";

        /**
         * The box which the message belong to, for example, MESSAGE_BOX_INBOX.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_BOX = "msg_box";

        /**
         * Has the message been read.
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String READ = "read";

        /**
         * The Message-ID of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MESSAGE_ID = "m_id";

        /**
         * The subject of the message, if present.
         * <P>Type: TEXT</P>
         */
        public static final String SUBJECT = "sub";

        /**
         * The character set of the subject, if present.
         * <P>Type: INTEGER</P>
         */
        public static final String SUBJECT_CHARSET = "sub_cs";

        /**
         * The Content-Type of the message.
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_TYPE = "ct_t";

        /**
         * The Content-Location of the message.
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_LOCATION = "ct_l";

        /**
         * The address of the sender.
         * <P>Type: TEXT</P>
         */
        public static final String FROM = "from";

        /**
         * The address of the recipients.
         * <P>Type: TEXT</P>
         */
        public static final String TO = "to";

        /**
         * The address of the cc. recipients.
         * <P>Type: TEXT</P>
         */
        public static final String CC = "cc";

        /**
         * The address of the bcc. recipients.
         * <P>Type: TEXT</P>
         */
        public static final String BCC = "bcc";

        /**
         * The expiry time of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String EXPIRY = "exp";

        /**
         * The class of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MESSAGE_CLASS = "m_cls";

        /**
         * The type of the message defined by MMS spec.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_TYPE = "m_type";

        /**
         * The version of specification that this message conform.
         * <P>Type: INTEGER</P>
         */
        public static final String MMS_VERSION = "v";

        /**
         * The size of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_SIZE = "m_size";

        /**
         * The priority of the message.
         * <P>Type: TEXT</P>
         */
        public static final String PRIORITY = "pri";

        /**
         * The read-report of the message.
         * <P>Type: TEXT</P>
         */
        public static final String READ_REPORT = "rr";

        /**
         * Whether the report is allowed.
         * <P>Type: TEXT</P>
         */
        public static final String REPORT_ALLOWED = "rpt_a";

        /**
         * The response-status of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String RESPONSE_STATUS = "resp_st";

        /**
         * The status of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String STATUS = "st";

        /**
         * The transaction-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String TRANSACTION_ID = "tr_id";

        /**
         * The retrieve-status of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String RETRIEVE_STATUS = "retr_st";

        /**
         * The retrieve-text of the message.
         * <P>Type: TEXT</P>
         */
        public static final String RETRIEVE_TEXT = "retr_txt";

        /**
         * The character set of the retrieve-text.
         * <P>Type: TEXT</P>
         */
        public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";

        /**
         * The read-status of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String READ_STATUS = "read_status";

        /**
         * The content-class of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String CONTENT_CLASS = "ct_cls";

        /**
         * The delivery-report of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_REPORT = "d_rpt";

        /**
         * The delivery-time-token of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";

        /**
         * The delivery-time of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_TIME = "d_tm";

        /**
         * The response-text of the message.
         * <P>Type: TEXT</P>
         */
        public static final String RESPONSE_TEXT = "resp_txt";

        /**
         * The sender-visibility of the message.
         * <P>Type: TEXT</P>
         */
        public static final String SENDER_VISIBILITY = "s_vis";

        /**
         * The reply-charging of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String REPLY_CHARGING = "r_chg";

        /**
         * The reply-charging-deadline-token of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok";

        /**
         * The reply-charging-deadline of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl";

        /**
         * The reply-charging-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String REPLY_CHARGING_ID = "r_chg_id";

        /**
         * The reply-charging-size of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String REPLY_CHARGING_SIZE = "r_chg_sz";

        /**
         * The previously-sent-by of the message.
         * <P>Type: TEXT</P>
         */
        public static final String PREVIOUSLY_SENT_BY = "p_s_by";

        /**
         * The previously-sent-date of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String PREVIOUSLY_SENT_DATE = "p_s_d";

        /**
         * The store of the message.
         * <P>Type: TEXT</P>
         */
        public static final String STORE = "store";

        /**
         * The mm-state of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MM_STATE = "mm_st";

        /**
         * The mm-flags-token of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MM_FLAGS_TOKEN = "mm_flg_tok";

        /**
         * The mm-flags of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MM_FLAGS = "mm_flg";

        /**
         * The store-status of the message.
         * <P>Type: TEXT</P>
         */
        public static final String STORE_STATUS = "store_st";

        /**
         * The store-status-text of the message.
         * <P>Type: TEXT</P>
         */
        public static final String STORE_STATUS_TEXT = "store_st_txt";

        /**
         * The stored of the message.
         * <P>Type: TEXT</P>
         */
        public static final String STORED = "stored";

        /**
         * The totals of the message.
         * <P>Type: TEXT</P>
         */
        public static final String TOTALS = "totals";

        /**
         * The mbox-totals of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MBOX_TOTALS = "mb_t";

        /**
         * The mbox-totals-token of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MBOX_TOTALS_TOKEN = "mb_t_tok";

        /**
         * The quotas of the message.
         * <P>Type: TEXT</P>
         */
        public static final String QUOTAS = "qt";

        /**
         * The mbox-quotas of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MBOX_QUOTAS = "mb_qt";

        /**
         * The mbox-quotas-token of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok";

        /**
         * The message-count of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_COUNT = "m_cnt";

        /**
         * The start of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String START = "start";

        /**
         * The distribution-indicator of the message.
         * <P>Type: TEXT</P>
         */
        public static final String DISTRIBUTION_INDICATOR = "d_ind";

        /**
         * The element-descriptor of the message.
         * <P>Type: TEXT</P>
         */
        public static final String ELEMENT_DESCRIPTOR = "e_des";

        /**
         * The limit of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String LIMIT = "limit";

        /**
         * The recommended-retrieval-mode of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod";

        /**
         * The recommended-retrieval-mode-text of the message.
         * <P>Type: TEXT</P>
         */
        public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";

        /**
         * The status-text of the message.
         * <P>Type: TEXT</P>
         */
        public static final String STATUS_TEXT = "st_txt";

        /**
         * The applic-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String APPLIC_ID = "apl_id";

        /**
         * The reply-applic-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String REPLY_APPLIC_ID = "r_apl_id";

        /**
         * The aux-applic-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String AUX_APPLIC_ID = "aux_apl_id";

        /**
         * The drm-content of the message.
         * <P>Type: TEXT</P>
         */
        public static final String DRM_CONTENT = "drm_c";

        /**
         * The adaptation-allowed of the message.
         * <P>Type: TEXT</P>
         */
        public static final String ADAPTATION_ALLOWED = "adp_a";

        /**
         * The replace-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String REPLACE_ID = "repl_id";

        /**
         * The cancel-id of the message.
         * <P>Type: TEXT</P>
         */
        public static final String CANCEL_ID = "cl_id";

        /**
         * The cancel-status of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String CANCEL_STATUS = "cl_st";

        /**
         * The thread ID of the message
         * <P>Type: INTEGER</P>
         */
        public static final String THREAD_ID = "thread_id";

        /**
         * Has the message been locked?
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String LOCKED = "locked";
    }



2、part表
    mmssms.db库中的part表存储了彩信内容(文本、音乐、图象)的文件名(即上面将的app_parts下面的文件名)、文件类型信息。
    其中“mid”对应着pdu表中的“_id”,“ct”是文件类型,“_data”是存储路径。

3 。 彩信文件读取

      彩信附件文件的地址存储在mmssms.db的part表的_data字段,形如“/data/data /com.android.providers.telephony/app_parts/PART_1262693697763”,但在应用中读取彩信 附件时,这个字段基本没什么用,因为不能直接读取这个文件。读取同样要通过ContentProvider,URI为“content://mms /part”,该URI就是对应着part表。可以使用下列代码段来读取文件:
String selection = new String("mid='" + key + "'");//这个key就是pdu里面的_id。
Cursor cur = getContentResolver().query(Uri.parse("content://mms/part"), null, selection, null, null);

        if (cur.moveToFirst())
            do {
                    int _partID = cur.getInt(cur.getColumnIndex("_id"));
                    String partID = String.valueOf(_partID);
                    Uri partURI = Uri.parse("content://mms/part/" + partID);
                   
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    InputStream is = null;

                    try {
                        is = getContentResolver().openInputStream(partURI);
                        byte[] buffer = new byte[256];
                        int len = is.read(buffer);
                        while (len >= 0)
                        {
                            baos.write(buffer, 0, len);
                            len = is.read(buffer);
                        }
                    } catch (IOException e) {
                    } finally {
                        if (is != null) {
                            try {
                                is.close();
                            } catch (IOException e) {

                            }
                        }
                    }
                    }
    这里得到的baos,就是附件文件。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值