Search code examples
androidandroid-firmware

Android `settings.db` reference?


Is there any reference about settings.db database file? I see mostly obviously variables but there is not enough for confidence.


Solution

  • There is hardly any reference. You should be using the Settings.System class to be access the system settings in Android. Using the Settings.System class, you are able to both read and write to the system settings.

    Checking Mobile Network:

     ConnectivityManager nInfo = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        nInfo.getActiveNetworkInfo().isConnectedOrConnecting();
    
        Log.d(tag, "Net avail:"
                + nInfo.getActiveNetworkInfo().isConnectedOrConnecting());
    
        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netInfo = cm.getActiveNetworkInfo();
        if (netInfo != null && netInfo.isConnectedOrConnecting()) {
            Log.d(tag, "Network available:true");
            return true;
        } else {
            Log.d(tag, "Network available:false");
            return false;
        }