Android Open Source - radioExpresWidget Location Service

From Project

Back to project page radioExpresWidget.


The source code is released under:

GNU General Public License

If you think the Android project radioExpresWidget 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

package com.hustaty.radioexpres.widget.service;
//w w w  .  java2s. c om
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.util.Log;

import com.hustaty.radioexpres.widget.util.LogUtil;

public class LocationService {

  // logger entry
  private final static String LOG_TAG = LocationService.class.getName();

  private static Location myLocation;

  public static Location obtainCurrentLocation(final Context context) {

    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    LocationService.myLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

    if (LocationService.myLocation == null) {

    Log.d(LOG_TAG, "#obtainCurrentLocation(): " + myLocation);
    LogUtil.appendLog(LOG_TAG + "#obtainCurrentLocation(): " + myLocation);

    return myLocation;



Java Source Code List