	public static void LogLocationToFile(Context context, Location myLoc)
	{
		Uri fileUri = null;
		SharedPreferences sharedPrefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		if (!DataStorage.isExternalStorageWritable())
		{
			Log.e(TAG, "External storage can not be written");
			Toast.makeText(context, "External Storage can not be written",
					Toast.LENGTH_SHORT).show();
		}
		try
		{
			File root;
			try
			{
				root = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
			}
			catch (Exception e)
			{
				root = Environment.getExternalStorageDirectory();
			}
			String path = root.getAbsolutePath();
			if (root.canWrite())
			{
				String timestamp = DateUtils.now("yyyy-MM-dd_HHmmssSSS");
				File textFile = new File(root, FILENAME + ".txt");
				FileWriter fw = new FileWriter(textFile);
				BufferedWriter out = new BufferedWriter(fw);
				out.append(timestamp + ": " 
						+ "LAT=" + myLoc.getLatitude()
						+ "LONG=" + myLoc.getLongitude() + "\n");
				out.close();
				File jsonFile = new File(root, FILENAME + ".json");
				fw = new FileWriter(jsonFile);
				out = new BufferedWriter(fw);
				out.append(timestamp + ": " 
						+ "LAT=" + myLoc.getLatitude()
						+ "LONG=" + myLoc.getLongitude() + "\n");
				Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
				out.append(gson.toJson(new TrackEntry(myLoc)));
				out.close();
			}
			else
			{
				Log.i(TAG,
						"Write error. "
								+ Environment.getExternalStorageDirectory()
								+ " couldn't be written");
			}
		} catch (Exception e)
		{
			Log.e(TAG, "Exception: " + e.getMessage());
		}
	}

	public static void LogLocationToFile(Context context, Location myLoc)
	{
		Uri fileUri = null;
		SharedPreferences sharedPrefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		if (!DataStorage.isExternalStorageWritable())
		{
			Log.e(TAG, "External storage can not be written");
			Toast.makeText(context, "External Storage can not be written",
					Toast.LENGTH_SHORT).show();
		}
		try
		{
			File root;
			try
			{
				root = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
			}
			catch (Exception e)
			{
				root = Environment.getExternalStorageDirectory();
			}
			String path = root.getAbsolutePath();
			if (root.canWrite())
			{
				String timestamp = DateUtils.now("yyyy-MM-dd_HHmmssSSS");
				File textFile = new File(root, FILENAME + ".txt");
				FileWriter fw = new FileWriter(textFile);
				BufferedWriter out = new BufferedWriter(fw);
				out.append(timestamp + ": " 
						+ "LAT=" + myLoc.getLatitude()
						+ "LONG=" + myLoc.getLongitude() + "\n");
				out.close();
				File jsonFile = new File(root, FILENAME + ".json");
				fw = new FileWriter(jsonFile);
				out = new BufferedWriter(fw);
				out.append("TrackEntry\n");
				Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
				out.append(gson.toJson(new TrackEntry(myLoc)));
				out.append("\n");
				out.close();
			}
			else
			{
				Log.i(TAG,
						"Write error. "
								+ Environment.getExternalStorageDirectory()
								+ " couldn't be written");
			}
		} catch (Exception e)
		{
			Log.e(TAG, "Exception: " + e.getMessage());
		}
	}
