I am sending messages using android SmsManager.sendTextMessage(..)
but while on reading the SMS content provider columns, I am getting the type column value 1 which should be 2 for sent messages and even on device default messaging app, my sent messages are showing as Received.
The code I am using to send the messages is
public static final String SMS_URI = "content://sms";
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(address.get(i), null, messagetosend, null, null);
ContentResolver contentResolver = getContentResolver();
ContentValues values = new ContentValues();
values.put(ADDRESS, address.get(i));
values.put(BODY, messagetosend);
contentResolver.insert(Uri.parse(SMS_URI), values);
And I am printing the values on Logcat with this piece of code:
Uri allMessages = Uri.parse("content://sms/");
//Cursor cursor = managedQuery(allMessages, null, null, null, null); Both are same
Cursor cursor = this.getContentResolver().query(allMessages, null, null, null, null);
while (cursor.moveToNext()) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
Log.d(cursor.getColumnName(i) + "", cursor.getString(i) + "");
}
Log.d("One row finished", "**************************************************");
}
Try to change
to
and you could also add