If you think the Android project Geotrackin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* This file is part of GPSLogger for Android.
*//fromwww.java2s.com
* GPSLogger for Android is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* GPSLogger for Android is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GPSLogger for Android. If not, see <http://www.gnu.org/licenses/>.
*/package com.geotrackin.gpslogger.loggers;
import android.content.Context;
import com.geotrackin.gpslogger.common.AppSettings;
import com.geotrackin.gpslogger.common.Session;
import com.geotrackin.gpslogger.common.Utilities;
import com.geotrackin.gpslogger.loggers.customurl.HttpUrlLogger;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
publicclass FileLoggerFactory {
publicstatic List<IFileLogger> GetFileLoggers(Context context) {
File gpxFolder = newFile(AppSettings.getGpsLoggerFolder());
if (!gpxFolder.exists()) {
gpxFolder.mkdirs();
}
List<IFileLogger> loggers = new ArrayList<IFileLogger>();
if (AppSettings.shouldLogToGpx()) {
File gpxFile = newFile(gpxFolder.getPath(), Session.getCurrentFileName() + ".gpx");
loggers.add(new Gpx10FileLogger(gpxFile, Session.shouldAddNewTrackSegment(), Session.getSatelliteCount()));
}
if (AppSettings.shouldLogToKml()) {
File kmlFile = newFile(gpxFolder.getPath(), Session.getCurrentFileName() + ".kml");
loggers.add(new Kml22FileLogger(kmlFile, Session.shouldAddNewTrackSegment()));
}
if (AppSettings.shouldLogToPlainText()) {
File file = newFile(gpxFolder.getPath(), Session.getCurrentFileName() + ".txt");
loggers.add(new PlainTextFileLogger(file));
}
if (AppSettings.shouldLogToOpenGTS()) {
loggers.add(new OpenGTSLogger());
}
if (AppSettings.shouldLogToCustomUrl()) {
float batteryLevel = Utilities.GetBatteryLevel(context);
String androidId = Utilities.GetAndroidId(context);
loggers.add(new HttpUrlLogger(AppSettings.getCustomLoggingUrl(), Session.getSatelliteCount(), batteryLevel, androidId));
}
return loggers;
}
}