gpt4 book ai didi

java - 如何在 Root设备上切换飞行模式?

转载 作者:行者123 更新时间:2023-11-29 20:56:06 25 4
gpt4 key购买 nike

<分区>

我正在使用以下方法:

private void toggleAirplaneMode() throws Exception {        
// read the airplane mode setting
boolean isEnabled = android.provider.Settings.System.getInt(
getContentResolver(),
android.provider.Settings.Global.AIRPLANE_MODE_ON, 0) == 1;

// toggle airplane mode
android.provider.Settings.System.putInt(
getContentResolver(),
android.provider.Settings.Global.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);

// Post an intent to reload
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", !isEnabled);
sendBroadcast(intent);
}

并得到以下异常:

12-30 09:49:05.875: D/tag(5876): android.os.Parcel.readException(Parcel.java:1540)
12-30 09:49:05.875: D/tag(5876): android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
12-30 09:49:05.875: D/tag(5876): android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
12-30 09:49:05.875: D/tag(5876): android.content.ContentProviderProxy.call(ContentProviderNative.java:643)
12-30 09:49:05.875: D/tag(5876): android.provider.Settings$NameValueCache.putStringForUser(Settings.java:1094)
12-30 09:49:05.876: D/tag(5876): android.provider.Settings$Global.putStringForUser(Settings.java:6827)
12-30 09:49:05.876: D/tag(5876): android.provider.Settings$Global.putString(Settings.java:6811)
12-30 09:49:05.876: D/tag(5876): android.provider.Settings$Global.putInt(Settings.java:6905)

我哪里错了?还有其他出路吗???

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com