Keywords: android APN settings problems sdk apn Settings "started data" disabled by default
Platform: S5PC110 S5PV210
System: android2.3 android2.3.4
Note:
(1), reference: http://www.bkjia.com/kf/201206/134101.html
(2) Application to program
Android2.3.4 _ GB_T34H \ build \ core \ main. mk
Android2.3.4 _ GB_T34H \ development \ data \ etc \ apns-conf.xml
Android2.3.4 _ GB_T34H \ development \ data \ etc \ apns-conf_sdk.xml
1. APN definition:
The Access Point Name (APN) is a parameter that must be configured when you Access the Internet through a mobile phone. It determines the Access method through which your mobile phone accesses the network, identifies the service type of GPRS. Currently, it is divided into two categories: CMWAP/UNIWAP/3 GWAP (accessing WAP service through GPRS), CMNET/UNINET/3 GNET (Other services except WAP currently use CMNET, such as connecting to the Internet ).
2. Analysis of the APN process in android
Apn process analysis and related documents
The relevant documents are described as follows:
Android2.3.4 _ GB_T34H \ build \ core \ main. mk
-- The xml file related to the apn settings can be seen from the [core Makefile file] of this file.
The excerpt is as follows:
# Install an apns-conf.xml file if one's not already being installed.
Ifeq (, $ (filter %: system/etc/apns-conf.xml, $ (PRODUCT_COPY_FILES )))
PRODUCT_COPY_FILES + = \
Development/data/etc/apns-conf_sdk.xml: system/etc/apns-conf.xml
Ifeq ($ (filter eng tests, $ (TARGET_BUILD_VARIANT )),)
$ (Warning implicitly installing apns-conf_sdk.xml)
Endif
Endif
Apns-conf_sdk.xml -- android2.3.4 _ GB_T34H/development/data/etc/apns-conf_sdk.xml
-- Mainly used to generate the system/etc/apns-conf.xml file, the generation process is essentially the original copy (for sdk simulation)
Apns. xml -- android2.3.4 _ GB_T34H/frameworks/base/core/res/xml/apns. xml
-- This file has no practical significance in the configuration of the apn, but it is very important in the logic of the android apn settings, especially the version value in it.
Apns-conf.xml -- android2.3.4 _ GB_T34H/out/target/product/generic/system/etc/apns-conf.xml
-- The content is finally packaged into system. ext4:
3. view results:
(1) Enter terminate
Adb shell
Cat/system/etc/apns-conf.xml
Note: This file is from here !!
TelephonyProvider. java -- android2.3.4 _ GB_T34H/packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider. java
-- This class is mainly used for APN settings. Because the source code does not meet the customization requirements, you must manually modify it!
However, the ultimate goal of the modification is to ensure that the database table content of the APN can be updated and maintained in a timely manner after the database version is updated!
The following describes how to modify this class!
First, ensure that Emulator or the Development Board is successfully run and view the data maintained by the APN. The operations are as follows:
# Adb shell
# Cd/data/com. android. providers. telephony/databases
# Sqlite3 telephony. db
Sqlite>. dump carriers
4. Implementation in the Program (refer to the article to modify the java code. I have not changed it here, but it can also be used)
(1) Open android2.3.4 _ GB_T34H \ development \ data \ etc \ apns-conf.xml
The corresponding name function is as follows: Pay attention to the values marked in red.
Name |
3g |
Name |
Apn |
3 gnet |
APN |
Proxy |
Not set |
Proxy |
Port |
Not set |
Port |
Username |
Not set |
User Name |
Password |
Not set |
Password |
Server |
Not set |
Service |
Mmsc |
Not set |
|
Mms proy |
Not set |
MMS proxy |
Mms prot |
Not set |
MMS Port |
Mmc |
460 |
|
Mnc |
01 |
|
Authentication |
|
|
Apn type |
Defaul |
APN type |
Apn protocol |
Ipv4 |
APN Protocol |
|
|
|
Corresponding to the code we want to add:
<! -- Modify by xu_bin -->
<Apn carrier = "3g"
Mcc = "460"
Mnc = "01"
Apn = "3 gnet"
User = ""
Password = ""
Server = ""
Mmsproxy = ""
Mmsport = ""
Mmsc = ""
Type = "default"
/>
2), before compiling the program, delete android2.3.4 _ GB_T34H \ out \ target \ product \ smdkc110 \ system \ etc \ apns-conf.xml
(3) Compile the program and install the program. The following figure shows the implementation result: you do not need to manually set the program and automatically add the APN Internet Settings.
5. If the configuration is automatically enabled, traffic will be generated without your attention. Therefore, this function must be enabled when you use it. Therefore, set the default value to disabled.
(1) If you select "settings -- Wireless Network -- Mobile Network -- data enabled", you can access the Internet without selecting "no", so we disable this option by default.
In the program: android2.3.4 _ GB_T34H \ frameworks \ base \ services \ java \ com \ android \ server \ ConnectivityService. java
[Java]/**
* @ See ConnectivityManager # getMobileDataEnabled ()
*/
Public boolean getMobileDataEnabled (){
EnforceAccessPermission ();
Boolean retVal = Settings. Secure. getInt (mContext. getContentResolver (),
// Settings. Secure. MOBILE_DATA, 1) = 1;
Settings. Secure. MOBILE_DATA, 0) = 1; // leilei ++ 10.25
If (DBG) Slog. d (TAG, "getMobileDataEnabled returning" + retVal );
Return retVal;
}
/**
* @ See ConnectivityManager # getMobileDataEnabled ()
*/
Public boolean getMobileDataEnabled (){
EnforceAccessPermission ();
Boolean retVal = Settings. Secure. getInt (mContext. getContentResolver (),
// Settings. Secure. MOBILE_DATA, 1) = 1;
Settings. Secure. MOBILE_DATA, 0) = 1; // leilei ++ 10.25
If (DBG) Slog. d (TAG, "getMobileDataEnabled returning" + retVal );
Return retVal;
} In the case of Settings. Secure. MOBILE_DATA, 1) = 1;, the option is enabled by default. In the case of Settings. Secure. MOBILE_DATA, 0) = 1;, the option is disabled by default.
(2) The implementation effect is as follows:
From xubin341719