I send Android sms, every time I try to retrieve the data.
Data form:
- Destination phone number
- Delivery time
- SMS entity P> Does anyone know?
Receive SMS in the Sent Box.
Public listing & lt; Smsreep & gt; GetOutboxSms () {if (null == reference) {New Array List & lt; SmsRep & gt; (); } Uri Uri SMS = Uri.Parse ("Content: // SMS / Sent"); Cursor cursor = context.getContentResolver (). Query (Yuri SMS, empty, empty, empty, empty); & Lt; SmsRep & gt; OutboxSms = cursor2SmsArray (cursor); If (! Cursor.isClosed ()) {cursor.close (); } Return Outbox Sms; }
and the method of handling the data in the Sent Box:
Public Stable List & lt; SmsRep & gt; Cursor 2 SSRU (cursor cursor) {if (null == cursor || 0 == cursor.gatecount ()) {new array list & lt; SMSRip & gt; (); } List & lt; SMSRip & gt; Message = new arreelist & lt; SMSRip & gt; (); Try (for cursor.moveToFirst); Cursor.isAfterLast (); cursor.moveToNext ()) {SmsRep singleSms = new SmsRep (); SingleSms.id = cursor.getInt (cursor.getColumnIndexOrThrow ("_ id")); SingleSms.address = cursor.gate string (cursor.est columnindexorpora ("address")); SingleSms.timestamp = CursorGetLong (cursor.est columnindexorto ("date") / 1000; // ### Sent time singleSMS. type = cursor.getINT (cursor.gate columnindexorro ("type")); SingleSms.protocol = CursorGetINT (cursor.tastemilindexortro ("protocol"); / * String smsSubject = cursor.getString (cursor.stasta column index ("subject")); Byte [] subjByts = smsSubject.getBytes ("UTF8"); SingleSms.subject = New string (yield, "UTF8"); * / String smsBody = cursor.gate string (cursor.gatcolom index ("body")); // ### Body Byte [] Bodybits = smsBody.getBytes ("UTF8"); SingleSms.body = TextUtils.html Encoded (new string (bodybites, "UTF8")); // escape ¼ ?? Handle '=' single sms. Device id = device id; //singleSms.body = Cursor.Get String (cursor.gettextortro ("body"); Messages.add (singleSms); }} Hold (exception e) {log (e.m., tag, e.m.m. message); } Finally {cursor.close (); } Return message; }
Definition of SMSRP:
Public class SMSRip {Fixed string separator; Public anti id; Public string address; Public long timestamp; Public act type; Public entrant protocols; Public string theme; Public string body; Public string device id; Public SMSRP () {nothing in Ctor}}
Do you want it? :)
Comments
Post a Comment