android2.3.5 CDMA/EVDO dial-up APN Solution _android

Source: Internet
Author: User
Google provides the android2.3, only in the GSM/WCDMA case can be from the "Settings"-> "Wireless and Network"-> "mobile network"-> "Access Point Name" to select a different APN account for dial-up connection, and cdma/ EVDO does not have this function. Recently looked at the code, the simple implementation of this function.

1, the defaultThe CDMA/EVDO inside even the APN list does not show, must first dig out this.
Modify Packages/apps/phone/res/xml/cdma_options.xml
Add the following content
Copy Code code as follows:

<preferencescreen
android:key= "Button_apn_key"
android:title= "@string/apn_settings"
Android:persistent= "false" >
<intent android:action= "Android.intent.action.MAIN"
Android:targetpackage= "Com.android.settings"
android:targetclass= "Com.android.settings.ApnSettings"/>
</PreferenceScreen>

There are Development/data/etc/apns-conf.xml version value changed to the original plus 1, reason code inside find.
2, modifyThe SetupData function of Frameworks/base/telephony/java/com/android/internal/telephony/cdma/cdmadataconnectiontracker.java
Copy Code code as follows:

Private Boolean SetupData (String reason) {
Cdmadataconnection conn = Findfreedataconnection ();
if (conn = = null) {
if (DBG) log ("Setupdata:no free cdmadataconnection found!");
return false;
}
Mactivedataconnection = conn;
String[] types;
if (Mrequestedapntype.equals (Phone.apn_type_dun)) {
types = new String[1];
Types[0] = Phone.apn_type_dun;
} else {
types = Mdefaultapntypes;
}
MACTIVEAPN = new Apnsetting (0, "", "", "", "", "", ",", "", "", "", "", "", "", "", "", "", ""
0, types, "IP", "IP");
Uri Preferred_apn_uri = Uri.parse ("CONTENT://TELEPHONY/CARRIERS/PREFERAPN");
Contentresolver cresolver = Phone.getcontext (). Getcontentresolver ();
Cursor cr = Cresolver.query (Preferred_apn_uri, NULL, NULL, NULL, NULL);
Cr.movetofirst ();
String user = cr.getstring (cr.getcolumnindex ("user"));
String pass = cr.getstring (Cr.getcolumnindex ("password"));
String APN = cr.getstring (Cr.getcolumnindex ("APN"));
LOG.E (Log_tag, "get apn:apn=" + APN + ", user=" + user + ", password=" + pass);
MACTIVEAPN = new Apnsetting (0, "", "", APN, "", "", "", "", ",", "," "," "," "
, types, "IP", "IP");
Message msg = Obtainmessage ();
Msg.what = Event_data_setup_complete;
Msg.obj = reason;
Conn.connect (msg, MACTIVEAPN);
SetState (state.initing);
Phone.notifydataconnection (reason);
return true;
}

3, modifyFrameworks/base/telephony/java/com/android/internal/telephony/cdma/cdmadataconnection.java's OnConnect function:
Copy Code code as follows:

Phone.mCM.setupDataCall (
Integer.tostring (RILCONSTANTS.SETUP_DATA_TECH_CDMA),
Integer.tostring (Dataprofile),
NULL, NULL, NULL,//original dialing parameters are empty!!!
CP.APN.APN, Cp.apn.user, Cp.apn.password,
Integer.tostring (Rilconstants.setup_data_auth_pap_chap),
RILCONSTANTS.SETUP_DATA_PROTOCOL_IP, MSG);

4, modifyframeworks/base/telephony/java/com/android/internal/telephony/gsm/ The definition of apnsetting in Apnsetting.java, which sets its member type to public

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.