// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java
// public abstract static class LocationResult {
// 	/**
// 	 * Call back with the found location.
// 	 * @param location	found location
// 	 */
// 	public abstract void gotLocation(Location location);
// }
// 
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Login.java
// public static class LoginException extends Exception {
// 	/**
// 	 *
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	/**
// 	 * No message constructor.
// 	 */
// 	public LoginException() {
// 
// 	}
// 
// 	/**
// 	 * Message constructor.
// 	 * @param description	description of exception
// 	 */
// 	public LoginException(final String description) {
// 		super(description);
// 	}
// }


import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.ByteArrayBuffer;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.location.Location;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;
import com.attentec.LocationHelper.LocationResult;
import com.attentec.Login.LoginException;

		Log.d(TAG, "Old locUpEn: " + previousLocationUpdateEnabled + " new locUpEn: " + PreferencesHelper.getLocationUpdateEnabled(ctx));
		if (PreferencesHelper.getLocationUpdateEnabled(ctx) != previousLocationUpdateEnabled) {
			//remove the old notifications
			mNM.cancelAll();
			//show the new one
			showNotification();
		}
		previousLocationUpdateEnabled = PreferencesHelper.getLocationUpdateEnabled(ctx);
	}

	/**
	 * Stop all recurring tasks and location updates.
	 */
	private void shutdownService() {
		//close database connection
		dbh.close();
		//stop the syncing of contacts and location fetches
		locationTimer.cancel();
		ownLocationTimer.cancel();
		contactsTimer.cancel();
		//remove all notifications
		mNM.cancelAll();
		isAlive = false;
		Intent serviceStoppedIntent = new Intent(COM_ATTENTEC_SERVICE_CHANGED_STATUS);
		sendBroadcast(serviceStoppedIntent);
	}

	/**
	 * Callback connector for new location from GPS.
	 */

// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/LocationHelper.java
// public abstract static class LocationResult {
// 	/**
// 	 * Call back with the found location.
// 	 * @param location	found location
// 	 */
// 	public abstract void gotLocation(Location location);
// }
// 
// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/Login.java
// public static class LoginException extends Exception {
// 	/**
// 	 *
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	/**
// 	 * No message constructor.
// 	 */
// 	public LoginException() {
// 
// 	}
// 
// 	/**
// 	 * Message constructor.
// 	 * @param description	description of exception
// 	 */
// 	public LoginException(final String description) {
// 		super(description);
// 	}
// }


// Path: at.attentec.com/android/at.attentec.client/src/com/attentec/AttentecService.java
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.ByteArrayBuffer;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.location.Location;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;
import com.attentec.LocationHelper.LocationResult;
import com.attentec.Login.LoginException;

		Log.d(TAG, "Old locUpEn: " + previousLocationUpdateEnabled + " new locUpEn: " + PreferencesHelper.getLocationUpdateEnabled(ctx));
		if (PreferencesHelper.getLocationUpdateEnabled(ctx) != previousLocationUpdateEnabled) {
			//remove the old notifications
			mNM.cancelAll();
			//show the new one
			showNotification();
		}
		previousLocationUpdateEnabled = PreferencesHelper.getLocationUpdateEnabled(ctx);
	}

	/**
	 * Stop all recurring tasks and location updates.
	 */
	private void shutdownService() {
		//close database connection
		dbh.close();
		//stop the syncing of contacts and location fetches
		locationTimer.cancel();
		ownLocationTimer.cancel();
		contactsTimer.cancel();
		//remove all notifications
		mNM.cancelAll();
		isAlive = false;
		Intent serviceStoppedIntent = new Intent(COM_ATTENTEC_SERVICE_CHANGED_STATUS);
		sendBroadcast(serviceStoppedIntent);
	}

	/**
	 * Callback connector for new location from GPS.
	 */

	private LocationResult locationResult = new LocationResult() {
