简体   繁体   中英

Get email extra from new outgoing call intent

I'm writing a BroadcastReceiver that responds to the NEW_OUTGOING_CALL action. Meaning, every time the user makes a new phone call - my BroadcastReceiver is called.

I want to get the email of the contact the user is calling.

Here are the extras I can get from the intent: Bundle[{android.phone.extra.ALREADY_CALLED=false, android.intent.extra.PHONE_NUMBER=123, android.phone.extra.ORIGINAL_URI=tel:123}]

Any ideas? Thanks.

You may want to have a look at the Contacts API which allows you to look up various contact informations in different ways. And then maybe go via the PhoneLookup table to quickly find a contact id for a phone number.

If you haven't used the Contacts API be prepared to learn some 'interesting' approaches and bear in mind that, more and less behind the scenes, it's all only about building select statements for DB tables. - But see for yourself: Using contacts API .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM