android - Get SMS of specific phone number -
android - Get SMS of specific phone number -
i wondering, how can read sms message specific number programmatically? know how read sms using content provider not sure if should utilize "person" column or "address" column or totally different way please help thanks
it list out messages specified number.
uri msmsinboxqueryuri = uri.parse("content://sms/inbox"); cursor cursor1 = getcontentresolver().query(msmsinboxqueryuri,new string[] { "_id", "thread_id", "address", "person", "date","body", "type" }, null, null, null); startmanagingcursor(cursor1); string[] columns = new string[] { "address", "person", "date", "body","type" }; if (cursor1.getcount() > 0) { string count = integer.tostring(cursor1.getcount()); while (cursor1.movetonext()){ string address = cursor1.getstring(cursor1.getcolumnindex(columns[0])); if(address.equalsignorecase("number")){ //put number here string name = cursor1.getstring(cursor1.getcolumnindex(columns[1])); string date = cursor1.getstring(cursor1.getcolumnindex(columns[2])); string body = cursor1.getstring(cursor1.getcolumnindex(columns[3])); string type = cursor1.getstring(cursor1.getcolumnindex(columns[4])); log.d("*******", "body="+body); } } }
but came across "content://mms-sms/conversations/"
think homecoming straight entire conversation of specific number help thread_id
, check this
android
Comments
Post a Comment