Search in sources :

Example 11 with TrackerDataHelper

use of com.android.locationtracker.data.TrackerDataHelper in project android_frameworks_base by ParanoidAndroid.

the class TrackerActivity method exportCSV.

private void exportCSV() {
    String exportFileName = getUniqueFileName("csv");
    exportFile(null, exportFileName, new TrackerDataHelper(this, TrackerDataHelper.CSV_FORMATTER));
}
Also used : TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Example 12 with TrackerDataHelper

use of com.android.locationtracker.data.TrackerDataHelper in project android_frameworks_base by ParanoidAndroid.

the class TrackerActivity method clearData.

private void clearData() {
    Runnable clearAction = new Runnable() {

        public void run() {
            TrackerDataHelper helper = new TrackerDataHelper(TrackerActivity.this);
            helper.deleteAll();
        }
    };
    showConfirm(R.string.delete_confirm, clearAction);
}
Also used : TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Example 13 with TrackerDataHelper

use of com.android.locationtracker.data.TrackerDataHelper in project android_frameworks_base by ParanoidAndroid.

the class TrackerService method initLocationListeners.

private synchronized void initLocationListeners() {
    mTrackerData = new TrackerDataHelper(this);
    LocationManager lm = getLocationManager();
    mTrackedProviders = getTrackedProviders();
    List<String> locationProviders = lm.getAllProviders();
    mListeners = new ArrayList<LocationTrackingListener>(locationProviders.size());
    long minUpdateTime = getLocationUpdateTime();
    float minDistance = getLocationMinDistance();
    for (String providerName : locationProviders) {
        if (mTrackedProviders.contains(providerName)) {
            Log.d(LOG_TAG, "Adding location listener for provider " + providerName);
            if (doDebugLogging()) {
                mTrackerData.writeEntry("init", String.format("start listening to %s : %d ms; %f meters", providerName, minUpdateTime, minDistance));
            }
            LocationTrackingListener listener = new LocationTrackingListener();
            lm.requestLocationUpdates(providerName, minUpdateTime, minDistance, listener);
            mListeners.add(listener);
        }
    }
    mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    if (doDebugLogging()) {
        // register for cell location updates
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION);
        // Register for Network (Wifi or Mobile) updates
        mNetwork = new NetworkStateBroadcastReceiver();
        IntentFilter mIntentFilter;
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
        mIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
        mIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        Log.d(LOG_TAG, "registering receiver");
        registerReceiver(mNetwork, mIntentFilter);
    }
    if (trackSignalStrength()) {
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    }
    // register for preference changes, so we can restart listeners on
    // pref changes
    mPrefListener = new PreferenceListener();
    getPreferences().registerOnSharedPreferenceChangeListener(mPrefListener);
}
Also used : LocationManager(android.location.LocationManager) IntentFilter(android.content.IntentFilter) TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Example 14 with TrackerDataHelper

use of com.android.locationtracker.data.TrackerDataHelper in project android_frameworks_base by DirtyUnicorns.

the class TrackerService method initLocationListeners.

private synchronized void initLocationListeners() {
    mTrackerData = new TrackerDataHelper(this);
    LocationManager lm = getLocationManager();
    mTrackedProviders = getTrackedProviders();
    List<String> locationProviders = lm.getAllProviders();
    mListeners = new ArrayList<LocationTrackingListener>(locationProviders.size());
    long minUpdateTime = getLocationUpdateTime();
    float minDistance = getLocationMinDistance();
    for (String providerName : locationProviders) {
        if (mTrackedProviders.contains(providerName)) {
            Log.d(LOG_TAG, "Adding location listener for provider " + providerName);
            if (doDebugLogging()) {
                mTrackerData.writeEntry("init", String.format("start listening to %s : %d ms; %f meters", providerName, minUpdateTime, minDistance));
            }
            LocationTrackingListener listener = new LocationTrackingListener();
            lm.requestLocationUpdates(providerName, minUpdateTime, minDistance, listener);
            mListeners.add(listener);
        }
    }
    mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    if (doDebugLogging()) {
        // register for cell location updates
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION);
        // Register for Network (Wifi or Mobile) updates
        mNetwork = new NetworkStateBroadcastReceiver();
        IntentFilter mIntentFilter;
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
        mIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
        mIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        Log.d(LOG_TAG, "registering receiver");
        registerReceiver(mNetwork, mIntentFilter);
    }
    if (trackSignalStrength()) {
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    }
    // register for preference changes, so we can restart listeners on
    // pref changes
    mPrefListener = new PreferenceListener();
    getPreferences().registerOnSharedPreferenceChangeListener(mPrefListener);
}
Also used : LocationManager(android.location.LocationManager) IntentFilter(android.content.IntentFilter) TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Example 15 with TrackerDataHelper

use of com.android.locationtracker.data.TrackerDataHelper in project android_frameworks_base by DirtyUnicorns.

the class TrackerActivity method exportKML.

private void exportKML() {
    String exportFileName = getUniqueFileName(LocationManager.NETWORK_PROVIDER + ".kml");
    exportFile(LocationManager.NETWORK_PROVIDER, exportFileName, new TrackerDataHelper(this, TrackerDataHelper.KML_FORMATTER));
    exportFileName = getUniqueFileName(LocationManager.GPS_PROVIDER + ".kml");
    exportFile(LocationManager.GPS_PROVIDER, exportFileName, new TrackerDataHelper(this, TrackerDataHelper.KML_FORMATTER));
}
Also used : TrackerDataHelper(com.android.locationtracker.data.TrackerDataHelper)

Aggregations

TrackerDataHelper (com.android.locationtracker.data.TrackerDataHelper)20 IntentFilter (android.content.IntentFilter)5 LocationManager (android.location.LocationManager)5