What do the values mean for the CallLog.Calls.CACHED_NUMBER_TYPE field?
I have queried the call log on Android. Some calls have 0 and other have 1 for the CallLog.C开发者_如何学运维alls.CACHED_NUMBER_TYPE field. What do these numbers mean? Does 1 mean "Home"? Where is this documented?
AFAIK, it is not explicitely documented. But if you read the source code of android you'll see that what is used are integers defined in
http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone.html
(See allowed DATA2).
About how to retreive that in the relevant android source : for example in the tests =>
https://github.com/android/platform_packages_providers_contactsprovider/blob/c085b3eeebf13ebdfb197444747354a1d6eced2b/tests/src/com/android/providers/contacts/CallLogProviderTest.java#L81
If you want to do more things with call logs and callers infos that I've extracted a standalone version of Android's CallerInfo class :
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/models/CallerInfo.java
It allows me to cache by my own display name (which is not necessarily done by all android contact apps of all manufacturers -- HTC sense).
Also, keep in mind that all these Cached values may be erased by the contact app when it will refresh the screen. If you want to make sure your value remain the only way I found for now is to create an associated contact.
See https://github.com/Wysie/android_packages_apps_Contacts/blob/c3772f17c37817ebb4eb925146c3a633aa258aa2/src/com/android/contacts/RecentCallsListActivity.java#L364
(The source code of the call log app, that automatically refresh cached values).
Warning this code may differ on custom distrib from manufacturers. From example, as I said, HTC do that differently in their HTC Sense. And even inside android AOSP versions it changes. And no doubt samsung do things their own way in their UI for example.
精彩评论