如何获取MMS id Android应用程序

时间:2012-04-08 18:26:45

标签: android broadcastreceiver mms

任何人都可以帮我找到彩信ID,我使用this代码获取彩信,但我不知道彩信ID(mmsId)所以我停止了!!

我会感谢您的帮助

萨米拉

1 个答案:

答案 0 :(得分:0)

Uri mmsInboxUri = Uri.parse("content://mms");               
Cursor mmsInboxCursor = getContentResolver().query(mmsInboxUri ,new String[]     
    {"_id","msg_box","ct_t","date"}, "msg_box=1 or msg_box=2", null, null);
int count = mmsInboxCursor.getCount(); 
if(mmsInboxCursor != null){

    try{

         if (mmsInboxCursor.moveToFirst())
         {                  
            do{

                System.out.println("<====MONITORING MESSAGES====>");                                
                int id = mmsInboxCursor.getString(0); 
              }while(mmsInboxCursor.moveToNext());
        }
    }catch (Exception e) {

        System.out.println("MMSMonitor :: startMMSMonitoring Exception== "+ e.getMessage());
    }
}