Note that there are some explanatory texts on larger screens.

plurals
  1. POGPS - getting lat and longitude in android
    primarykey
    data
    text
    <p>I am using following code to get current latitude and longitude. But none of the toasts are displayed. </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Use the LocationManager class to obtain GPS locations */ LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener); } /* Class My Location Listener */ public class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { Log.i("","loccccccccccc"); loc.getLatitude(); loc.getLongitude(); String Text = "My current location is: " + "Latitud = " + loc.getLatitude() + "Longitud = " + loc.getLongitude(); Toast.makeText( getApplicationContext(), Text, Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String provider) { Toast.makeText( getApplicationContext(), "Gps Disabled", Toast.LENGTH_SHORT ).show(); } @Override public void onProviderEnabled(String provider) { Toast.makeText( getApplicationContext(), "Gps Enabled", Toast.LENGTH_SHORT).show(); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } } </code></pre> <p>used all the permissions: </p> <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; </code></pre> <p>Thanks for the help in advance<br> Sneha</p>
    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.
 

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