Note that there are some explanatory texts on larger screens.

plurals
  1. POCan the GPS in android emulator track my current position?
    primarykey
    data
    text
    <p>i have made a program to find the current location using GPS in android emulator that is working correctly , and is showing the correct latitudes and longitudes that i send from emulator control in eclipse, but is it possible that the GPS in the emulator could show my current location by itself , i.e. in a way track my location and show it by itself without having me to send it through the emulator control.</p> <p>Here is the code:</p> <pre><code>package location.finder; 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 LocationFinderActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LocationManager locationManager= (LocationManager)this.getSystemService(Context.LOCATION_SERVICE); LocationListener locationListener = new loclistener(); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener); } public class loclistener implements LocationListener { public void onLocationChanged(Location location){ String loc ="Latitude = " + location.getLatitude() +" Longitude = " + location.getLongitude(); Toast.makeText( getApplicationContext(),loc,Toast.LENGTH_SHORT).show(); } public void onStatusChanged(String provider , int status, Bundle extras) { } public void onProviderEnabled(String provider) { Toast.makeText( getApplicationContext(),"Gps Enabled",Toast.LENGTH_SHORT).show(); } public void onProviderDisabled(String provider) { Toast.makeText( getApplicationContext(),"Gps Disabled",Toast.LENGTH_SHORT ).show(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload