IntentFilter intentFilter =
new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
registerReceiver(connChanged,intentFilter);
+ connChangedRegistered = true;
boolean wifion = wifiman.setWifiEnabled(true);
Log.w("WhereAmI", "enabling wifi result " + wifion);
mHandler.postDelayed(resetInfo, 30000);
private Runnable resetInfo = new Runnable () {
public void run() {
Log.w("WhereAmI", "resetInfo starting");
- unregisterReceiver(connChanged);
+ if (connChangedRegistered) {
+ unregisterReceiver(connChanged);
+ connChangedRegistered = false;
+ }
if (runningtasks > 0) {
for (int i = 0; i < ut.length; i++) {
ut[i].cancel();
}
};
+ private boolean connChangedRegistered = false;
private final BroadcastReceiver connChanged = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
public void onPause()
{
super.onPause();
- Log.w("WhereAmI", "calling finish");
- finish();
+ Log.w("WhereAmI", "going background");
}
/** Called when the activity is destroyed. */
mHandler.removeCallbacks(updateClock);
mHandler.removeCallbacks(updateCal);
mHandler.removeCallbacks(updateInfo);
- //unregisterReceiver(connChanged);
+ if (connChangedRegistered) {
+ unregisterReceiver(connChanged);
+ connChangedRegistered = false;
+ }
boolean wifion = wifiman.setWifiEnabled(false);
Log.w("WhereAmI", "disabling wifi result " + wifion);
}