Page 1 of 1

Search contact by name recognized from input speech (exper)

Posted: 22 Nov 2013 08:53
by etaon
Help please to create script
input speech (Experimental) gave me value with text (name of contact)
need search contact witn name(value) in database android and extract number of phone or other info.
I try do it with http://stackoverflow.com/questions/6994 ... in-android
or like this code (i know, that search name by number)

Code: Select all

Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(contactNumber));
ContentResolver cr = getContentResolver();
Cursor c = cr.query(uri, new String[] {BaseColumns._ID, ContactsContract.PhoneLookup.DISPLAY_NAME }, null, null, null);

String contactName;

try {
    if (c != null && c.getCount() > 0) {
        c.moveToNext();
        contactName = c.getString(c.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
    }
} finally {
    if (c != null) {
        c.close();
    }
}
Ok. Scripts in program dont be work with this code.
How can i do it? Run outdoor scripts in storage/scripts?