How to turn off mobile data connection for Android 4.4 first boot

Source: Internet
Author: User

When the default Android system is first used, the mobile data connection is automatically opened. If you have a SIM card, there will be traffic. Although there is a setup wizard at the first use that prompts you if you want to turn off the data connection, it's a little uncomfortable when you see it: Mobile data is open without my consent. You may be able to close the data connection quickly, but when you have finished setting up, and then go to settings-and-traffic usage, you can see that the mobile data is generating traffic.

Recently there is such a demand, in the android4.4 off the system default data connection, combined with the Internet to find information, tracking to Connectivityservice class, location is frameworks/base/services/java/com/ Android/server,

In which the following methods are found:

public Boolean getmobiledataenabled () {        //todo:this detail should probably is in Dataconnectiontracker ' s        //
   
    which is where we store the value and maybe make this        //       asynchronous.        Enforceaccesspermission ();        Boolean retVal = Settings.Global.getInt (Mcontext.getcontentresolver (),                Settings.Global.MOBILE_DATA, 1) = = 1;        if (vdbg) log ("getmobiledataenabled returning" + retVal);        return retVal;    }
   

The default value where you can Settings.Global.MOBILE_DATA the string corresponds to the initial value of 1,getmobiledataenabled is true. When you try to change the default value to 0, the mobile data connection still has a connection.

During the test, the mobile data is still connected and then closed. This is because Google connects to a test site the first time it is powered on, so it causes the connection to move data and generate traffic.

The solution is to find the method checkmobileprovisioning () in the Connenctivityservice.java class , and then add the following code at the beginning:

Final int uid = Binder.getcallinguid (); Log ("checkmobileprovisioning callinguid" + uid); Boolean ismobileprovision = Mcontext.getresources (). Getboolean (Com.mediatek.internal.r.bool.is_mobile_ Provision_ Enabled); Log ("Ismobileprovision:" + ismobileprovision  ); if (!ismobileprovision) {    


How to turn off mobile data connection for Android 4.4 first boot

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.