getSystemService is undefined for the type for GetLocation
<p>I have GetURL method defined to find my location from network provider, you can send the code below.</p>

<p>If I define that code piece in my main class with Activity this works nicely but when I would like to create a seperate class (for instance GetLocation class), I cannot use getSystemService method and I receive error in subject (getSystemService is undefined for the type for GetLocation). There are couple of entries regarding this topic but I don't understand fully.</p>

<p>That's a rookie question so take this into account while answering :) Thanks guys.</p>

<pre><code>public String GetURL () {
    LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    String locationProvider = LocationManager.NETWORK_PROVIDER;
    mostRecentLocation = locationManager.getLastKnownLocation(locationProvider);
    if(mostRecentLocation != null) {
        double lat = mostRecentLocation.getLatitude();
        double lng = mostRecentLocation.getLongitude();
        currentLocation = "Lat: " + lat + " Lng: " + lng;
        Log.e("LOCATION -------------", currentLocation + "");
    }
    return currentLocation;
}
</code></pre>
