How to set the AIRPLANE_MODE_ON to “True” or ON?

后端 未结 3 966
鱼传尺愫
鱼传尺愫 2020-11-27 16:53

I am planning to drop a call and I find this as one of workaround for that. How do I activate the airplane mode via code?

This way I will drop the call based on so

3条回答
  •  渐次进展
    2020-11-27 17:34

      public static boolean getAirplaneMode(Context context) {
          try {
          int airplaneModeSetting = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON);
          return airplaneModeSetting==1?true:false;
        } catch (SettingNotFoundException e) {
          return false;
        }
      }
    

提交回复
热议问题