Wie erhalte ich eine E-Mail für eine bestimmte Telefonnummer?
Ich möchte eine E-Mail für eine bestimmte Telefonnummer erhalten.
Hier ist mein Code
private static String getEmailAndName(String number, Context context) {
String selection = ContactsContract.CommonDataKinds.Phone.NUMBER+" like'%" + number +"%'";
String[] projection = new String[] {ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.DATA};
Cursor c = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, selection, null, null);
String aniName = "";
if (c.moveToNext()) {
aniName = c.getString(0);
Log.e(TAG, "Name ====== "+c.getString(0));
Log.e(TAG, "Email ====== "+c.getString(1));
Log.e(TAG, "Email ====== "+c.getString(2));
}
return aniName;
}
Aber es wird keine E-Mail-ID zurückgegeben.