Finds a contact in the native contacts list based on the filter string provided. The filter string is matched against all the properties of the contact like name, phone, email etc.
$m.findContact(function(response){ if(response.code){ var contacts = response.result; } else{ $m.toast(response.error.message); } }); |
Syntax
$m.findContact(filter[, fp_callback])
Parameters
filter
string (required)
The filter string to search in contacts list for matching contacts.
fp_callback
function (optional)
The function to execute when the find contact operation is completed. The function receives a response object as parameter with the following properties,
- code - {Number}. The value can be 0 or 1. 1 indicates that the find operation is successful. 0 indicates a failure.
- result - {Array}. Array of contact objects that matched the specified filter.
- error - {Object}. Available when the code is 0. The error object contains,
- message - {String}. A short description of the error.
- description - {String}. A detailed description of the error.