Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Answering the first two points</strong>:</p> <ul> <li><p>GPS will <strong>always</strong> give you a more precise location, <em>if it is enabled and if there are no thick walls around</em>.</p></li> <li><p>If location did not change, then you can call <a href="http://developer.android.com/reference/android/location/LocationManager.html#getLastKnownLocation%28java.lang.String%29">getLastKnownLocation(String)</a> and retrieve the location immediately.</p></li> </ul> <p><strong>Using an alternative approach</strong>:</p> <p>You can try getting the <strong>cell id</strong> in use or all the neighboring cells</p> <pre><code>TelephonyManager mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); GsmCellLocation loc = (GsmCellLocation) mTelephonyManager.getCellLocation(); Log.d ("CID", Integer.toString(loc.getCid())); Log.d ("LAC", Integer.toString(loc.getLac())); // or List&lt;NeighboringCellInfo&gt; list = mTelephonyManager.getNeighboringCellInfo (); for (NeighboringCellInfo cell : list) { Log.d ("CID", Integer.toString(cell.getCid())); Log.d ("LAC", Integer.toString(cell.getLac())); } </code></pre> <p>You can refer then to cell location through several open databases (e.g., <a href="http://www.location-api.com/">http://www.location-api.com/</a> or <a href="http://opencellid.org/">http://opencellid.org/</a> )</p> <hr> <p>The strategy would be to read the list of tower IDs when reading the location. Then, in next query (10 minutes in your app), read them again. If at least some towers are the same, then it's safe to use <code>getLastKnownLocation(String)</code>. If they're not, then wait for <code>onLocationChanged()</code>. This avoids the need of a third party database for the location. You can also try <a href="http://www.anddev.org/poor_mans_gps_-_celltowerid_-_location_area_code_-lookup-t257.html">this approach</a>.</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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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