title: getting altitude/latitude/longitude from GPS
body: <p>I am trying to run the code below to get the user location (altitude/latitude/longitude) but it's not working. During the debugging is appearing the following message:</p>
  
  <p>_<strong>No command output when running: 'am start -D -n net.learn2develop.get_location/net.learn2develop.get_location.Getting_CoordinatesActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' on device emulator-5554_</strong></p>
  
  <p><em><strong>com.android.ddmlib.ShellCommandUnresponsiveException</em></strong>
  <em><strong>at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)</em></strong>
  <em><strong>at com.android.ddmlib.Device.executeShellCommand(Device.java:276)</em></strong>
  <em><strong>at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:74)</em></strong>
  <em><strong>at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launchApp(AndroidLaunchController.java:1147)</em></strong>
  <em><strong>at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.clientChanged(AndroidLaunchController.java:1493)</em></strong>
  <em><strong>at com.android.ddmlib.AndroidDebugBridge.clientChanged(AndroidDebugBridge.java:870)</em></strong>
  <em><strong>at com.android.ddmlib.Device.update(Device.java:398)</em></strong>
  <em><strong>at com.android.ddmlib.Client.update(Client.java:835)</em></strong>
  <em><strong>at com.android.ddmlib.HandleAppName.handleAPNM(HandleAppName.java:90)</em></strong>
  <em><strong>at com.android.ddmlib.HandleAppName.handleChunk(HandleAppName.java:64)</em></strong>
  <em><strong>at com.android.ddmlib.MonitorThread.callHandler(MonitorThread.java:414)</em></strong>
  <em><strong>at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:322)</em></strong>
  <em><strong>at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)</em></strong></p>
  
  <p>What could be wrong/missing?</p>
  
  <p><strong>Manifest:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="net.learn2develop.get_location"
        android:versionCode="1"
        android:versionName="1.0"&gt;
  
      &lt;uses-sdk android:minSdkVersion="8"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"&gt;&lt;/uses-permission&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"&gt;&lt;/uses-permission&gt;
  
  
      &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
         &lt;activity android:name=".Getting_CoordinatesActivity"
                android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
        &lt;/activity&gt;
  
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Java Code:</strong></p>
  
  <pre><code>package net.learn2develop.get_location;
  
  
  import android.app.Activity;
  import android.content.Context;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.widget.Toast;
  
  
  public class Getting_CoordinatesActivity extends Activity {    
  
      private LocationManager myLocationManager;
      private LocationListener myLocationListener;
  
  
      public void onLocationChanged(Location location) {
          String Text = "Latitude = "    + location.getLatitude()  + 
                    "\nLongitude = " + location.getLongitude() + 
                    "\nAltitude = "  + location.getAltitude();
  
          Toast.makeText( getApplicationContext(), Text, Toast.LENGTH_LONG ).show();  
      }
  
  
      public void onProviderDisabled(String provider) {
  
      }
  
  
      public void onProviderEnabled(String provider) {
  
      }
  
  
      public void onStatusChanged(String provider, int status, Bundle extras) {
  
      }
  
  
      protected void onDestroy(){
          super.onDestroy();
          //getLocationManager().removeUpdates( this );     
      } 
  
      /** Called when the activity is first created. */
      @Override    
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
  
          myLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);    
          myLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,          
              0, 0, myLocationListener); 
  
  
      }
  
  
  
  }
  </code></pre>
  
  <p>Thanks in advance</p>