Android first 10-bit match, if not match, then replace 7-bit match

Source: Internet
Author: User

If some overseas demand, for number match number of digits, need first 10 bit match, if cannot match, then replace 7 bit match

Examples of specific situations:
Case 1:
If you have saved: a:04165191666, b:5191666, the call number is: 04165191666
Because it is a 7-bit match, both A and B can match, but the best match is a, and the last shows A;
Call 5191666 is matched to B.
Case 2:
Save a:04165191666 only,
Call 5191666 or 04165191666 matches a.
Case 3:
Save b:5191666 only,
The call 5191666 or 04165191666 matches B.


On the basis of 7 match, the matching number match can be further filtered.

First, you need to modify the Min_match to 7-bit matching, please modify the following two files to ensure that return Min_match are 7
1, Phonenumberutils.java in the Min_match;
2, OldPhoneNumberUtils.cpp in the Min_match;

In addition, please modify the Dialersearchutils.java (alps\packages\providers\contactsprovider\src\com\android\providers\contacts) in the
public static cursor findnumberexactmatchedcursor (cursor cursor, String normalizednumber) method
Here's a description:


This method is based on the number matching, then filters the exact number and returns
Input parameters:
The cursor is the data returned after all 7-bit matches, followed by an exact match from the face.
Normalizednumber is the number used by Call/mms
Output:
If the return is already matched, the
Matrixcursor exactcursor = matrixcursorfromcursorrow (cursor, cursor.getposition ());
Cursor.close ();
return exactcursor;
If there is no match, then
return null;

Two other numbers, please explain:
Normalizednumber is the number used by Call/mms
Data1 is the full number found in the database.
You can make a guest in this function to meet the requirements.

Android first 10-bit match, if not match, then replace 7-bit match

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.