Question

Some of my users report that on their Samsung devices (GT-N7000 & SGH-I777) a query I make in my app for the CallLog.Calls displays also text messages.

I've created a dump of their CallLog ContentProvider, and it seems to have extra fields not mentioned in the Android API, and not returned on any of our test devices.

Specifically, looking through the dump, there's a field called logtype, which seems to equal 100 for calls, and 300 for text messages. Having searching online for this field, I didn't find any official documentation for this field's values, but I came across lots of other possible values for this field mainly via crash stack traces, which reveal underlining queries by the ContentProvider:

logtype=300 OR logtype=200

logtype=100 OR logtype=500 OR logtype=800 OR logtype=900 OR logtype=1000

So I assume that 300/200 are used for text messages, and 100/500/800/900/1000 are used for calls, but I'm not sure, since I haven't seen 500/800/900/1000 being used on the reporting users' devices.

Can someone shed some light for the possible values of logtype, and their meaning?

Was it helpful?

Solution 2

I've managed to tentatively solve it by querying CallLog.Calls for the column logtype, if an exception is thrown, I query normally, otherwise, I query with selection of (logtype=100 OR logtype=500)

This seems to be working for my reporting users, but I'm still not sure if it covers all bases, since there are many possible values for logtype for which I don't know the meaning.

If anyone has a better answer, please add it.

OTHER TIPS

Hello If you will check callLog.Calls columns you will find messageid field which says that this is message for samsung phones. So if you just want to get the list of calls without messages simply do :

int messageIdIndex=cursor.getColumnIndex("messageid");

while (cursor.moveToNext()) {

if(messageIdIndex>=0)
    messageID=cursor.getLong(messageIdIndex);

if(messageID<=0)
{
    //do whatever you need with calls log data
}

}

cursor.close();

When i was debugging a sgs2 device i have found this. may be useful for someone.

SELECT number, name, type, date, duration FROM logs WHERE (
logs.logtype=100 OR 
logs.logtype=110 OR 
logs.logtype=900 OR 
logs.logtype=500 OR 
logs.logtype=800 OR 
logs.logtype=120 OR 
logs.logtype=510 OR 
logs.logtype=1000 OR 
(logs.logtype=200 AND number NOT IN (SELECT number FROM logs WHERE number LIKE '%@%')) OR logs.logtype=300) 
AND ((type != 4)) AND (logtype=100 OR logtype=500))) 
ORDER BY date DESC

So far, we have found Samsung devices using the value 1150, 100 or 1000 for the 'logtype' field in the Calls content provider.

I cannot confirm if any of the other values mentioned here are used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top