Q: Getting Exception Service Not Available While Trying to Get Current Location Latitude & Longitude this question might be duplicate,but not getting satisfied answer so here i am throwing my issue.i am trying to fetch current location latitude and longitude using geocoder,before 2days i was able to get latitude and longitude but today getting exception:java.io.IOException: Service not Available
here is the way i am trying to get latitude and longitude
//**current latitude and longitude

        try{
        lm = (LocationManager) RestaurantDetail.this.getSystemService(Context.LOCATION_SERVICE);
        criteria = new Criteria();
        bestProvider = lm.getBestProvider(criteria, false);
        location = lm.getLastKnownLocation(bestProvider);
        }
        catch(Exception e){

            Log.e("Finding Current Location:",e.toString());
        }

        if (location == null){
            Toast.makeText(RestaurantDetail.this,"Location Not found",Toast.LENGTH_LONG).show();

        }else{

        try {
            geocoder = new Geocoder(RestaurantDetail.this);    
            user = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
            lat=(double)user.get(0).getLatitude();
            lng=(double)user.get(0).getLongitude();
            lat1=lat;
            long1=lng;

           Log.e("Latitude:","Current:"+lat1+""+long1+"\n"+"add"+lat2+""+long2);


         try{
           float results[] = new float[3];
           Location.distanceBetween(lat1,long1,lat2,long2, results);
           float distance = results[0];
           distance=(float) ((distance)*0.000621371);
           Tv_restorentdetail_disData.setText(""+distance+"miles");
           }catch(Exception e){

               Log.e("Counting Distance Exception:",e.toString());
           }
           }catch (Exception e) {
               e.printStackTrace();   
               Tv_restorentdetail_disData.setText("Service Not Available");
           }

my project version is 4.0 with google api
 and i am testing my project in Samsung tab having android version>4.0 
 here is a list of permission i have given to manifest file
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

any help or suggestion will be appreciated thanks any way!

A: private LocationManager locationManager;
private LocationListener locationListener;
 public void Get_current_location()
    {
        locationManager=(LocationManager)this.getSystemService(LOCATION_SERVICE);
        final ProgressDialog pg=new ProgressDialog(this);
        pg.setTitle("Fetching Location");
        pg.setMessage("please wait....");
        pg.show();
        locationListener=new LocationListener()
        {

            public void onStatusChanged(String provider, int status, Bundle extras) 
            {
                // TODO Auto-generated method stub

            }

            public void onProviderEnabled(String provider)
            {
                // TODO Auto-generated method stub

            }               
            public void onProviderDisabled(String provider) 
            {
                // TODO Auto-generated method stub
                Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                startActivity(intent);
            }

            public void onLocationChanged(Location location) 
            {
                // TODO Auto-generated method stub
                Geocoder gcd=new Geocoder(getBaseContext());
                try
                {
                    List<Address>addresses=gcd.getFromLocation(location.getLatitude(), location.getLongitude(), 5);
                    Address address=addresses.get(0);
                     gps_countryName=address.getCountryName().toString();
                     gps_stateName=address.getAdminArea().toString();
                     gps_cityName=address.getLocality().toString();                     
                     gps_countryCode=address.getCountryCode().toString();
                     Log.i("gps countrycode", gps_countryCode);                     
                     locationManager.removeUpdates(locationListener);    
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }

            }
        };
        locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
    }

