// 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;

			try {
				ServerContact.postJSON(postdata, url, ctx);
			} catch (LoginException e) {
				//Login was wrong, so close activity
				endAllActivities();
				return;
			}
			lastUpdatedToServer = new Date().getTime();
		}
	}

	/**
	 * get users Locations from server.
	 * @return true on success
	 */
	@SuppressWarnings("unchecked")
	public final boolean getLocations() {
		Log.d(TAG, "getLocations");

		//fetch locations from server
		SharedPreferences sp = getSharedPreferences("attentec_preferences", MODE_PRIVATE);
		String username = sp.getString("username", "");
		Hashtable<String, List<NameValuePair>> postdata = ServerContact.getLogin(username, sp.getString("phone_key", ""));

		JSONArray users = null;
		JSONObject js = null;
		ContentValues cv;

		try {
			js = ServerContact.postJSON(postdata, "/app/user_locations_and_status.json", ctx);

// 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;

			try {
				ServerContact.postJSON(postdata, url, ctx);
			} catch (LoginException e) {
				//Login was wrong, so close activity
				endAllActivities();
				return;
			}
			lastUpdatedToServer = new Date().getTime();
		}
	}

	/**
	 * get users Locations from server.
	 * @return true on success
	 */
	@SuppressWarnings("unchecked")
	public final boolean getLocations() {
		Log.d(TAG, "getLocations");

		//fetch locations from server
		SharedPreferences sp = getSharedPreferences("attentec_preferences", MODE_PRIVATE);
		String username = sp.getString("username", "");
		Hashtable<String, List<NameValuePair>> postdata = ServerContact.getLogin(username, sp.getString("phone_key", ""));

		JSONArray users = null;
		JSONObject js = null;
		ContentValues cv;

		try {
			js = ServerContact.postJSON(postdata, "/app/user_locations_and_status.json", ctx);

		} catch (LoginException e) {
