Android Add MCCMNC auto number match after dial match not to contact

Source: Internet
Author: User

Because different SIM cards correspond to different MCCMNC, the value of Min_match is changed,
The new Min_match value does not persist with the min_match saved in the previous Phone_lookup table, resulting in a mismatch.

Modify the following:
1. Add a URI
Modify Contactsprovider2.java,
private static final int phone_lookup = 4000;
Add one line below:
private static final int phone_lookup2 = 4001; New ADD

Matcher.adduri (contactscontract.authority, "Provider_status", provider_status);
Add one line below:
Matcher.adduri (contactscontract.authority, "phone_lookup2", phone_lookup2); New ADD

2. Implement a method to handle the corresponding URI
Modify the Contactsprovider2.java updateintransaction ().
Case PHONE_LOOKUP2:
Final Sqlitedatabase mDb = Mdbhelper.get (). Getwritabledatabase (); Mdb
Cursor C = mdb.query (Tables.phone_lookup,
New string[]{phonelookupcolumns.data_id,
PHONELOOKUPCOLUMNS.RAW_CONTACT_ID,
Phonelookupcolumns.normalized_number,
Phonelookupcolumns.min_match},
NULL, NULL, NULL, and NULL);
while (C.movetonext ()) {
Long dataid = C.getlong (0);
Long Rawcontactid = C.getlong (1);
String Normalizenumber = c.getstring (2);
String Oldminmatch = c.getstring (3);


Contentvalues phonevalues = new Contentvalues ();
Phonevalues.put (phonelookupcolumns.raw_contact_id, Rawcontactid);
Phonevalues.put (phonelookupcolumns.data_id, dataid);
Phonevalues.put (Phonelookupcolumns.normalized_number, Normalizenumber);

Get Minmatch
LOG.D (TAG, "[Phone_lookup2]1.normalizenumber:" + normalizenumber);
String Minmatch = Phonenumberutils.tocalleridminmatch (Normalizenumber);

Phonevalues.put (Phonelookupcolumns.min_match, Minmatch);
LOG.D (TAG, "[Phone_lookup2]2.normalizenumber:" + Normalizenumber + "Oldminmatch:" + Oldminmatch + "Minmatch:" + minMat CH);
Mdb.update (Tables.phone_lookup, phonevalues, phonelookupcolumns.data_id + "=" + Dataid + "and" + phonelookupcolumns.raw_ contact_id + "=" + Rawcontactid, NULL);
}
C.close ();
Break

3. Start the min_match of the Update phone_lookup table
------------[JB 4.2]------------
Modify the Abstractstartsimservice.java under the contacts package
Case Finish_importing This case before the break in front of Canstopself () by adding the following code:
... ...
if (canstopself) {
LOG.I (TAG, "would call stopself here.")
New add
Contentresolver contentresolver = Mcontext.getcontentresolver ();
Uri uri = uri.parse ("content://com.android.contacts/phone_lookup2");
Contentresolver.update (URI, New contentvalues (), NULL, NULL);
End
Stopself ();
}
------------[KK 4.4]------------
Modify Simprocessormanager.java,simprocessormanager ()-Handlemessage (),
Add the following code before Callstopservice ():
... ...
LOGUTILS.D (TAG, "Handlemessage msf_send_stop_service");
New add
Contentresolver contentresolver = Mcontext.getcontentresolver ();
Uri uri = uri.parse ("content://com.android.contacts/phone_lookup2");
Contentresolver.update (URI, New contentvalues (), NULL, NULL);
End
Callstopservice ();
... ...

Android Add MCCMNC auto number match after dial match not to contact

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.