gps

Change minTime for GPS LocationListener dynamically

对着背影说爱祢 提交于 2019-12-02 12:31:34
The app that I'm writing uses the GPS location manager service requestLocationUpdates() but I would like to be able to change the min Time and min Distance parameters throughout the program. I initialize the location listener on creation but I can't figure out how to change these parameters or even find out if it's possible to do that. The main purpose for this would be to conserve battery life when the program doesn't need regular position updates. Thanks so much for your help! -Dom Judah Sali I'm not sure if this is correct, but faced with the same problem, I occasionally remove the

Using LocationClient to get Location updates

一曲冷凌霜 提交于 2019-12-02 12:17:45
问题 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;

GPSTracker Class not working

早过忘川 提交于 2019-12-02 11:57:36
I have tried to use a GPSTracker class that I found online in my application, and I had it working earlier, but it seems to now inexplicably not work. public class GPSTracker extends Service implements LocationListener { private static final String TAG = "GPSTracker"; private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location = null; // location double latitude; // latitude double longitude; // longitude // The minimum distance to

How to test GPS status?

谁说我不能喝 提交于 2019-12-02 11:45:59
I now create an app to detect the location of device through GPS, I have problem with GPS status, I look through the GpsStatus.Listener but it's complicated since I'm a newbie with Android. HERE IS WHAT I TRY TO DO WITH GPS STATUS AM I ON THE RIGHT TRACK ??? final Listener onGpsStatusChange = new GpsStatus.Listener() { @Override public void onGpsStatusChanged(int event) { // TODO Auto-generated method stub switch(event){ case GpsStatus.GPS_EVENT_STARTED: // Started... break ; case GpsStatus.GPS_EVENT_FIRST_FIX: // First Fix... break ; case GpsStatus.GPS_EVENT_STOPPED: // Stopped... break ; } }

GPS Location tracking even when app is closed(Not running in Background)/ScreenLocked

谁说我不能喝 提交于 2019-12-02 11:33:10
I want to track user location very similar to strava, even after the is closed. I tried AlarmManager but it's not giving me execution after every one minute Just using a Service as BiGGZ explained won't work in case the device enters sleep mode. The Service won't be killed though but your app won't get any CPU. Therefore you would have to acquire a partial Wakelock to prevent the device from entering sleep mode. @Override public void onCreate() { super.onCreate(); PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); wakeLock = m.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,

Find Long/Lat inside of polygon with MySQL 5.6

烂漫一生 提交于 2019-12-02 11:03:12
I have a locations table that has many rows of locations and data. There are 2 columns inside of that - Longitude and Latitude. I want to find records from that table that are found in a defined map polygon area. I have a second table that I just created based on some tutorials called polyThing which has my defined boundary... CREATE TABLE polyThing ( `ID` int auto_increment primary key, `boundary` polygon not null, `testarea` varchar(200) NOT NULL ); INSERT INTO polyThing (boundary, testarea) VALUES( PolygonFromText( 'POLYGON(( -114.018522 46.855932 , -113.997591 46.856030 , -113.997447 46

Location object passed into onLocationChanged is null?

和自甴很熟 提交于 2019-12-02 10:39:34
I have an activity that implements LocationListener in my application and my onLocationChanged method has been working perfectly up until recently. For some reason the Location object being passed into the method is null. My question is, why is it null? Does it pass in a null object if it cannot acquire a location? My GPS is on and I have it set to pull a location from the GPS, and I know my GPS can get a fix on me as I used Maps and had it locate me. Also, I have the permission for my app set as: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name=

enabling GPS programmatically not working

我与影子孤独终老i 提交于 2019-12-02 10:13:55
I am trying to enable/disable (toggle) GPS programmatically in my app via a button click, but it is not working. Please help. My target devices are not rooted. Here's the code I'm using. private void gps() { Intent intent=new Intent("android.location.GPS_ENABLED_CHANGE"); Button gps = (Button)findViewById(R.id.gpsButton); if(isGPSon()) { intent.putExtra("enabled", true); gps.setText(R.string.f2_gps_deact); } else { intent.putExtra("enabled", false); gps.setText(R.string.f2_gps_act); } sendBroadcast(intent); You can't enable GPS programatically. The most you can do is open the settings for the

iOS CoreLocation: Is it possible to know if the location data is coming from GPS or from Wifi?

风流意气都作罢 提交于 2019-12-02 10:12:17
问题 I was wondering if we can get the source type of the current location in iOS. I didn't find any reference nor in CLLocationManager neither in CLLocation . I've found the same question here in SO, but for Android: Is it possible to know my location came from gps or glonass? Android. How to know if location detected is from GPS or Network provider The second one has an answer that says if the accuracy is smaller than 30 meters, than it is using GPS. But I don't know if we really can assume that

fake Geolocation in chrome automation

孤人 提交于 2019-12-02 09:55:01
I need to automate geolocation in chrome using python script. I have to fake the latitude and longitude. I followed some links in stackoverflow but they gave errors. chromeDriver.executeScript("window.navigator.geolocation.getCurrentPosition=function(success){var position = {"coords" : {"latitude": "555","longitude": "999"}};success(position);}"); is there any other way i can change the location? You have to escape double quotes inside a string please try with below code: driver.execute_script("window.navigator.geolocation.getCurrentPosition=function(success){"+ "var position = {\"coords\" : {