在5.0要跳转到网络设置界面
if (android.os.Build.VERSION.SDK_INT > 13) {
// 3.2以上打开设置界面,也可以直接用ACTION_WIRELESS_SETTINGS打开到wifi界面
context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
} else {
context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
下面的在4.0时可以设置,5.0报错
if (android.os.Build.VERSION.SDK_INT > 10) {
intent = new Intent(
android.provider.Settings.ACTION_WIRELESS_SETTINGS);
} else {
intent = new Intent();
ComponentName component = new ComponentName(
"com.android.settings",
"com.android.settings.WirelessSettings");
intent.setComponent(component);
intent.setAction("android.intent.action.VIEW");
}
context.startActivity(intent);