gps

Android Location not returning Location from Custom Class

一个人想着一个人 提交于 2019-12-04 21:51:58
I have my own location class. I have an odds result that when I search for the GPS location using my class, I get 0, 0 back. Whereas if I search the getLastKnown function in location manager for GPS, I get the forced value: public Location getGPSloc(Context c){ isGPSavailable(c); if(gps_enabled) lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, locationListenerGps); timerGPS = new Timer(); timerGPS.schedule(new GetLastLocationGPS(), 45000); return gpsLoc; } This is the class that I'm calling from outside the function, I am using this.getApplicationContext() in the call. This is

Show current location of user on an offline static image (jpeg) - Android

南笙酒味 提交于 2019-12-04 21:51:48
Background / Concept: I want to create an application that can help user searching for specific things. Let say nearby restaurants. Here I want to include an offline map covering 1 km area around that restaurant, (its easy i can take snap of google map). Problem: is it possible to indicate current user position on that static image file? I have some idea that I note the Lat / Long of all four corners of that image, take user current position, do some calculation and show the current spot.. But I m not sure where to start and if there is already a good optimized solution. If I can show current

Get current lat long android

本小妞迷上赌 提交于 2019-12-04 20:48:02
I want to get the Location object on Button press. I know the LocationListener callbacks, however they execute only after a particular time or distance. I want to get Location instantaneously. Are there any methods to do so. You are welcome to call getLastKnownLocation() on LocationManager to retrieve the last known location for your requested location provider. However: that location may be old that location may be null Hence, your code will need to be able to cope with both of those scenarios. public class GPSHelper { private Context context; // flag for GPS Status private boolean

Sending GPS Coordinates via sms

只谈情不闲聊 提交于 2019-12-04 20:41:15
I am new to android. i am trying to develop an app which fetch users current GPS coordinates and send them via sms to a hardcoded number. I am using two activities, first one has a progress bar and some text( Processing, Please wait),it is actually fetching GPS coordinates in background. The second one is receiving coordinates from first activity and sending the sms. The problem which i m facing is that in MainActivity.java file the condition if(latitude>0) is never satisfied since gps normally take some time to get coordinates and I cant go to second activity. I m attaching the code, please

Altitude problem IOS

℡╲_俬逩灬. 提交于 2019-12-04 20:27:15
I have a problem in getting the altitude , it returns 0.0000 . Here is my code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSString *tAltitude = [NSString stringWithFormat:@"%f", [newLocation altitude]]; CLLocationCoordinate2D coord=newLocation.coordinate; MKCoordinateSpan span = {.latitudeDelta = 0.005, .longitudeDelta = 0.005}; MKCoordinateRegion region = {coord, span}; [map setRegion:region]; NSLog(@"Location: %@", [newLocation description]); NSLog(@"altitudine:%@",tAltitude); } If you are

AlarmManager & onStartCommand

£可爱£侵袭症+ 提交于 2019-12-04 20:22:43
I develop a GPS Tracking app on android. I use AlarmManager to wake up the device every 5 minutes. I developed a log file that shows that the application works great until a moment when I receieve public int onStartCommand(Intent intent, int flags, int startId) with startId = 1 again .... in this case I noticed that all variables are reset so I initialize all variables again .. the issue is that once this happens I keep getting same event with startID = 1 again and after few calls the app just stops until i open the ActivityForm and bind with service again !!! the log is here for the bad

How to get the current accurate GPS Coordinates using GPS_PROVIDER in android?

亡梦爱人 提交于 2019-12-04 19:58:52
I am developing an android app based on GPS location navigation for finding user current location. I am using GPS_PROVIDER I dont want to use any other provider like PASSIVE_PROVIDER or NETWORK_PROVIDER currently my code is working and it gives me the coordinates accurately but when I exit from application and again start the application it gives me slightly different coordinates from the old ones while I am on same place and same position. To find GPS coordinates I used following code. LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

How to find the gps in the android device is correctly working or not?

二次信任 提交于 2019-12-04 19:57:00
I'm developing an android application for mobiles and tablets. I'm using android version 2.2 , API 8. In my application, I want to capture the location co-ordinates via gps and send to server. It's working fine . When I working in my office (near to my office) the gps - co-ordinates captured correctly in android devices But in only one device the co-ordinates captured wrongly. I'm in Alwarpet,chennai,india .But, I run that device it shows " Andra pradesh" or bay of "bengal ".But all other device shows correct location. I think there is a fault in device. But I'm not sure. How to find the gps

android onLocationChanged never called

家住魔仙堡 提交于 2019-12-04 19:54:16
I've implemented code that should return present location. First the code: public static double[] getLocation(Context context) { double[] result; lm = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); MyLocationListener ll = new MyLocationListener(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll); while(!hasLocation) { } result = ll.getResult(); return result; } private static class MyLocationListener implements LocationListener { double[] result = new double[2]; public double[] getResult() { return result; } @Override public void onLocationChanged

How to plot a GPS location on an image being used as a map?

笑着哭i 提交于 2019-12-04 19:41:39
I have images of malls that I need to use as maps for an app I am making. I have the GPS lat/long of the bottom corners of the map and I figured out the distance from the bottom GPS coordinates to what would be the top of the map image. How ever these are not straight up and down linear maps meaning I can't just plot my lat and long all nice and neat. I've tried using various formulas and I'm so close but I can't plot the top lat and long of the top left and right of the map. So far this is what I have: double distanceFromLeftToRightGPS = bottomLeft.distanceTo(bottomRight); double