2016-07-08 31 views
-1

我想删除或禁用rooted android device.it中的飞行模式是否可能?我怎么能做到cording或任何东西。 -a android.intent.action.AIRPLANE_MODE --ez状态虚假如何删除或禁用android飞机模式

settings put global airplane_mode_on 0 

AM广播

+0

嗨使用此链接http://stackoverflow.com/questions/23537467/enable-airplane-mode-on-all-api-levels-programmatically-android –

回答

0

试试这个:

if (android.os.Build.VERSION.SDK_INT < 17){ 
try{ 
    Intent intentAirplaneMode = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); 
    intentAirplaneMode.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    startActivity(intentAirplaneMode); 
} 
catch (ActivityNotFoundException e){ 
    Log.e("exception", e + ""); 
} 
} 
else{ 
Intent intent1 = new Intent("android.settings.WIRELESS_SETTINGS"); 
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); 
} 
+0

此代码只能打开无线和网络window.not启用飞行模式 –

0

source

// 0 for disabling, 1 for enabling 
Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0); 

Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); 
intent.putExtra("state", 0); 
sendBroadcast(intent); 

要做到这你必须得到

<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>

在您的清单中并作为系统应用程序运行您的应用程序。

+0

你的手机api级别是什么,你是什么意思,你不能添加使用权限来显示? –