Android : Check phone number present in Contact List ? (Phone number retrieve from phone call)

前端 未结 4 1419
时光取名叫无心
时光取名叫无心 2021-02-02 14:03

I make a BroadcastReceiver to receive Phone number of the person who call me




        
4条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 14:29

    I suggest you to use Phone.CONTENT_FILTER_URI instead of PhoneLookup.CONTENT_FILTER_URI because PhoneLookup can be empty and you will get no result from time to time (tested on LG-P500, froyo)

    The problem on my device happens for example when:

    1. switch to airplane mode
    2. use the default message application to send a sms (will be queued).
    3. use PhoneLookup.CONTENT_FILTER_URI to query for a contact

    Not all devices seems to be affected

    Using PhoneLookup.CONTENT_FILTER_URI the returned cursor is always empty. Using Phone.CONTENT_FILTER_URI everything is ok (you find the contact if any).

    Therefore I suggest you to always use Phone.* Uris except when you really need to use PhoneLookup.*... Which usually is just address book synchronization related stuff (and most of the times is not what you are interested in).

提交回复
热议问题