is Location Expired - Android Map

Android examples for Map:Location

Description

is Location Expired

Demo Code


//package com.java2s;

import android.location.Location;

public class Main {
    private int mLocationExpiry = 0;

    public static boolean isLocationExpired(Location location,
            int locationExpiryMinutes) {
        if (location != null && locationExpiryMinutes > 0) {
            long diff = System.currentTimeMillis() - location.getTime();
            return (diff > (locationExpiryMinutes * 60 * 1000));
        }/*from  www . j a  va  2s. co  m*/
        return false;
    }

    public boolean isLocationExpired(Location location) {
        return isLocationExpired(location, mLocationExpiry);
    }
}

Related Tutorials