/* * 항공기 탑승모드 상태를 리턴 */ private boolean isAirplaneModeOn(Context context) { return Settings.System.getInt(context.getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) != 0; }
/* * 항공기 탑승모드상태 를 설정 */ private void setAirplaneMode(Context context, boolean status) { boolean isAirplaneModeOn = isAirplaneModeOn(context); if (isAirplaneModeOn == status) { return; } if (isAirplaneModeOn && !status) { Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", 0); context.sendBroadcast(intent); return; } if (!isAirplaneModeOn && status) { Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 1); Intent intent = new Intent (Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", 1); context.sendBroadcast(intent); return; } }
자답입니다. 항공기 탑승모드로 변경하는 소스코드 입니다.
로그인 유지
자답입니다. 항공기 탑승모드로 변경하는 소스코드 입니다.