Back to project page rfcx-guardian-android.
The source code is released under:
Apache License
If you think the Android project rfcx-guardian-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.rfcx.guardian.receiver; // w w w .j a va 2 s.com import java.util.Calendar; import org.rfcx.guardian.RfcxGuardian; import org.rfcx.guardian.utility.TimeOfDay; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.location.LocationManager; import android.net.wifi.WifiManager; import android.util.Log; public class AirplaneModeReceiver extends BroadcastReceiver { private static final String TAG = AirplaneModeReceiver.class.getSimpleName(); private RfcxGuardian app = null; private WifiManager wifiManager = null; private LocationManager locationManager = null; @Override public void onReceive(Context context, Intent intent) { if (app == null) app = (RfcxGuardian) context.getApplicationContext(); if (wifiManager == null) wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (locationManager == null) locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); /* * THIS WOULD BE A GREAT THING TO ADD TO THE DB DIAGNOSTICS * app.apiCore.resetSignalSearchClock(); */ TimeOfDay timeOfDay = new TimeOfDay(); if (app.verboseLog) Log.d(TAG, "(RfcxSource) AirplaneMode " + ( app.airplaneMode.isEnabled(context) ? "Enabled" : "Disabled" ) + " at "+(Calendar.getInstance()).getTime().toLocaleString()); // if (!app.airplaneMode.isEnabled(context)) { // if (timeOfDay.isDataGenerationEnabled(context) || app.ignoreOffHours) { // app.apiCore.setSignalSearchStart(Calendar.getInstance()); // wifiManager.setWifiEnabled(app.airplaneMode.getAllowWifi()); // } else { // if (app.verboseLogging) Log.d(TAG, "API Check-In not allowed right now"); // } // } } }