Ok, guys, here's my code for getting SMS:
Cursor cursor = getContentResolver().query(Uri.parse(uri),
null, CallLog.Calls.DATE + " > " + lastSmsTime, null,
CallLog.Calls.DATE + " ASC");
Where type is:
"content://sms/inbox"
"content://sms/sent"
And for calls:
String[] projection = new String[] { CallLog.Calls.NUMBER,
CallLog.Calls.TYPE, CallLog.Calls.DURATION, CallLog.Calls.DATE };
Cursor managedCursor = getContentResolver().query(
CallLog.Calls.CONTENT_URI, projection,
CallLog.Calls.DATE + " > " + lastCallTime, null,
CallLog.Calls.DATE + " ASC");
First of all, I know that this is undocumented provider(as you see, I use column constants from different one).
Funny thing is that this is working ok on several 2.3.x devices. But now I tried this on Galaxy S II(ICS 4.0.3). Now all SMS are duplicated in calls provider.
Has anyone come across this issue?
UPD I found the same question here, keep looking for the solution.
UDD 2 from what I know now, Samsung now stores everything in one log, so I'll try to find a way to reverse-engineer log application.
Anyway, still looking for solution to separate sms and calls.
Ok, that's might be the solution, so I'm posting it: Samsung logs provider has lot's of columns, among them is
logtype
which, as far as I see, for calls is 100, for SMS is 300 and for MMS is 200.
It's also possible to detect manufacturer:
String man = android.os.Build.MANUFACTURER;
So, for samsung devices there should be separate code which will check the logtype.