title: Android LocationListener not called
body: <p>I'm making an app that sends the present location through sms. But the location listener method is not called. It says:</p>
  
  <blockquote>
    <p>method LocationListener is never called</p>
  </blockquote>
  
  <p>Here's my code :</p>
  
  <pre><code>public class MainActivity2 extends Activity {
  
      LocationManager lm;
      LocationListener locationListener;
  
      private void LocationListener(Context context) {
          lm = (LocationManager)
                  context.getSystemService(Context.LOCATION_SERVICE);
  
          locationListener = new MyLocationListener();
          lm.requestLocationUpdates(
                  LocationManager.NETWORK_PROVIDER,
                  60000,
                  1000,
                  locationListener);
  
      }
  
      private class MyLocationListener implements LocationListener {
          @Override
          public void onLocationChanged(Location loc) {
              if (loc != null) {
                  String Uri = "http://maps.google.com/maps?saddr=" + loc.getLatitude() + "," + loc.getLongitude();
  
                  SmsManager smsManager = SmsManager.getDefault();
                  StringBuffer smsBody = new StringBuffer();
                  smsBody.append(Uri);
                  smsManager.sendTextMessage("+91847690****", null, smsBody.toString(), null, null);
  
                  lm.removeUpdates(locationListener);
              }
          }
  
          public void onProviderDisabled(String provider) {
          }
  
          public void onProviderEnabled(String provider) {
          }
  
          public void onStatusChanged(String provider, int status,
                                      Bundle extras) {
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
  
          getMenuInflater().inflate(R.menu.menu_main_activity2, menu);
          return true;
      }
  
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
  
          int id = item.getItemId();
  
  
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>