언어 설정

Menu
Sites
Language
Getting error while reading multiple numbers of contact

I am making an app in which i want all details of contact.
But  while reading multiple mobile numbers I am getting an errorcode -22(CONTACTS_ERROR_INVALID_PARAMETER) only for some contacts.

Here is my code,

contacts_db_get_record(_contacts_contact._uri,id, &record);

int child_phones_count = 0;
char *contact_number = NULL;

ret = contacts_record_get_child_record_count(record, _contacts_contact.number, &child_phones_count);
dlog_print(DLOG_ERROR,LOG_TAG,"Error getting child record count: %d",ret);

if (ret == CONTACTS_ERROR_NONE)
{
	int i;
	for (i = 0; i < child_phones_count; i++)
	{
		contacts_record_h child_record_phone = NULL;
		char *contact_number = NULL;

		if (contacts_record_get_child_record_at_p(record, _contacts_contact.number, i, &child_record_phone) == CONTACTS_ERROR_NONE
			&& contacts_record_get_str(child_record_phone, _contacts_number.number, &contact_number) == CONTACTS_ERROR_NONE
			&& contact_number != NULL)
		{
			dlog_print(DLOG_INFO,LOG_TAG,"Phone number : %s",contact_number);
		}
		else
		{
			
		}
	    free(contact_number);
	}
}

getting log like,

Error getting child record count: -22

Responses

1 댓글
Yasin Ali

Hi,

I think parameters are not properly formulated of this function in your code.

int contacts_record_get_child_record_count ( contacts_record_h record,
    unsigned int property_id,
    int * count
  )
Parameters:
[in] record The parent record handle
[in] property_id The property ID
[out] count The child record count

Check this link for detailed instruction and code hint.

https://developer.tizen.org/development/guides/native-application/personal-data/contacts

Hope it will help you.
If you find my post is helpful for you, please mark it as answer to promote this post to others.