package cn.ninegame.ad.demo.util;

import android.content.Context;
import android.location.Location;
import android.location.LocationManager;

public class PrivacyInfoUtil {

    private static final String TAG = "PrivacyInfoUtil";

    public static Location getGpsLocation(Context ctx){
        Location lastKnowLocation = null;
        try {
            LocationManager locationManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
            if (locationManager != null) {
                lastKnowLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
            }
            return lastKnowLocation;

        } catch (Exception e) {
            e.printStackTrace();
        }
        return lastKnowLocation;
    }
}
