如何从源代码访问 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 操作系统设置