gps

How to get location of android device by its android id

萝らか妹 提交于 2019-12-02 09:26:43
I am new in android and recently start learning about Android and I am trying to get location of any android device by its unique android id. By that I can track the approx or exact location either by GPS or network provider. In detail I mean to say that whenever i enter any Android id in my app i can get device location in my application. Thanks for your kind help. Finally I am able to do with this code: public class MyService extends Service implements LocationListener{ String GPS_FILTER = ""; Thread triggerService; LocationListener locationListener; LocationManager lm; private static final

How to fetch the current Location in every 1 min of interval?

血红的双手。 提交于 2019-12-02 08:38:13
I have implemented the Demo to show the current lat-long of the User. Now I am able to see the lat-long of the current Position. but I want to Set it to to be displayed in every 1 min of interval. The code is as below: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener lListener = new mylocationlistener(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, lListener

How to find out why GPS coordinates are missing in Android?

拟墨画扇 提交于 2019-12-02 08:17:00
I am trying to get a device's location information using GPS, but for some reason one of the two coordinates is missing sometimes. This is the code: LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); double longitude = location.getLongitude(); double latitude = location.getLatitude(); Log.d("LOCATION1", "Longitude: " + longitude); Log.d("LOCATION2", "Latitude: " + latitude); Sometimes I do get both coordinates, but not always, which makes me think about some kind of delay somewhere. Is

Is it possible to retrieve the GPRMC from device GPS?

五迷三道 提交于 2019-12-02 08:04:39
问题 I 'm looking for a way to obtain the GPRMC info from device GPS. Is it even possible in any way? 回答1: No, it is not possible. First GPRMC is a message from the text based NMEA protocoll, which is a not well defined protocoll, each chip manufacturer interprets it differently. Therfore most professional devices, use the binary protocoll from the Chip manufacturer. And even when Apple woud internally use the NMEA Protokoll to communicate with the chip, you would not have any access to that

how to convert gps north and gps west to lat/long in objective c

萝らか妹 提交于 2019-12-02 07:40:39
I got these values from server: <gps_n>34.22.123</gps_n> <gps_w>81.59.345</gps_w> I would like to convert these values to latitude/longitude in Objective C. Would you please give me a guide to do this? Thanks The formula for both lat/long (n/w) is: Degrees+(minutes/60)+(seconds/3600) From this page: http://webmaster10.com/ldr/lat-long-conversion.html The example you have given, already are latitude/longitude coordinates. There are many such lat,lon formats, what you want are lat/long coordinates in decimal degrees , probably with a sign to denote N/S or E/W. Use the formula above: ( Degrees+

Wait for current location - GPS - Android Dev

ε祈祈猫儿з 提交于 2019-12-02 06:56:24
I have to wait to get the current location, just like when you are in Google maps and it requests for your location. If it can't get any location inform the error and do nothing. I read the answers here and in web but all say that I have to use getLastKnownLocation method, but I don't need this, I just need the current location. If not, I don't do anything. Sam Read this from yesterday: GPS Android - get positioning only once But here is how you can get the current location: public class Example extends Activity implements LocationListener { LocationManager mLocationManager; @Override public

Update GPS Listener every 5 seconds

萝らか妹 提交于 2019-12-02 06:39:47
I'm supposed to update the listener every 5 seconds. But it doesn't. What could be wrong with my code? Thanks a lot for any help! package com.example.android.lbs; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.sql.Date; import java.text.SimpleDateFormat; 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.os.Environment; import android.util.Log; import android.view.View; import android

GpsStatus.Listener not firing on network status changes

跟風遠走 提交于 2019-12-02 06:37:47
问题 I want my RTT app to be able to control when/whether we are receiving location updates, no matter from GPS or network. I can easily control GPS status with a GpsStatus.Listener but I cannot find the equivalent for network updates. For example, the event would fire if we enter an area with no network or wifi, or a timeout will occur like in the case covered by GpsStatus.GPS_EVENT_SATELLITE_STATUS Codes snippets here: mGPSReceiver = (LocationManager)this.getSystemService(Context.LOCATION

Using LocationClient to get Location updates

谁说胖子不能爱 提交于 2019-12-02 06:27:15
How do i use locationclient class along with requestLocationUpdates(LocationRequest, LocationListener) to get location updates in android? I've tried the following code, but its not working. can any one help me with this? Where's the mistake, Thanks in advance. public class MainActivity extends FragmentActivity implements GooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedListener { private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000; LocationClient mLocationClient; Location mCurrentLocation; LocationRequest mLocationRequest; ArrayList

Event for gps on/off state change

﹥>﹥吖頭↗ 提交于 2019-12-02 05:51:40
问题 I want to listen a GPS state changes in my app, is there in android any intent-action which I can use in a broadCast receiver like an android.net.conn.CONNECTIVITY_CHANGE for network-state? 回答1: You can register a BroadcastReceiver for listening to Intent Action PROVIDERS_CHANGED_ACTION . or you can try this snippet GpsStatus.Listener gpsListener = new GpsStatus.Listener() { public void onGpsStatusChanged(int event) { if( event == GpsStatus.GPS_EVENT_FIRST_FIX){ showMessageDialog("GPS fixed")