0

如何从源代码访问 Android 操作系统设置?我可以访问某些设置,例如检查 Internet 连接

private void checkIntenet() {
        connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

        networkInfo = null;
        networkInfo = connectivityManager.getActiveNetworkInfo();
        if (networkInfo != null) {
            stringBuilder.append(getResources().getString(R.string.activeNetwork) + "\n");
            stringBuilder.append(getResources().getString(R.string.available) + " " + networkInfo.isAvailable() + "\n");
            stringBuilder.append(getResources().getString(R.string.connected) + " " + networkInfo.isConnected() + "\n");
            stringBuilder.append(getResources().getString(R.string.extra) + "" + networkInfo.getExtraInfo() + "\n" + "\n");
        } else {
            Toast.makeText(this, "networkInfo is null", Toast.LENGTH_SHORT).show();
        }
    }

但我无法访问 Android 操作系统设置

4

2 回答 2

0

您可以在此处访问这些 api 的隐藏 API 很少http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/

于 2014-01-09T10:19:09.073 回答
0

尝试这个;

startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));

于 2014-01-09T10:12:09.980 回答