本文
[java]
private BroadcastReceiver br = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action.equals("com.android.FMRadio.FlightClock")){
//擷取到飛航模式狀態 ,true開啟,false關閉
int isAirplaneMode = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) ;
boolean find = (isAirplaneMode == 1)?true:false;
if(find){
Toast.makeText(mContext, R.string.toast_in_flight, Toast.LENGTH_SHORT).show();
if (mIsPlaying) {
refreshImageButton(false);
refreshActionMenuItem(false);
refreshPopupMenuItem(false);
refreshActionMenuPower(false);
exitService();
return;
}
}
}
}
};
private BroadcastReceiver br = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action.equals("com.android.FMRadio.FlightClock")){
//擷取到飛航模式狀態 ,true開啟,false關閉
int isAirplaneMode = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) ;
boolean find = (isAirplaneMode == 1)?true:false;
if(find){
Toast.makeText(mContext, R.string.toast_in_flight, Toast.LENGTH_SHORT).show();
if (mIsPlaying) {
refreshImageButton(false);
refreshActionMenuItem(false);
refreshPopupMenuItem(false);
refreshActionMenuPower(false);
exitService();
return;
}
}
}
}
};