locationmanager

How to continue monitoring iBeacon when screen is off in iOS?

不想你离开。 提交于 2020-01-04 01:19:08
问题 I am developing an iOS app to monitor iBeacons. It works well in both foreground and background. I also need it to keep monitoring even when the screen is off. Now my problem is, when I turn off the screen with the shoulder button, NSLog shows that the iBeacon signal goes off (RSSI=0, beacon.accuracy=-1.0) accordingly, and 10 seconds later, there is no beacon found at all, while the delegate method locationManager:didRangeBeacons:inRegion: is called continuously. It seems that the app is

addProximityAlert doesn't work as expected

北慕城南 提交于 2020-01-01 06:42:06
问题 ios sdk has great region monitoring functions. I need something like that in android and i think we have two alternatives. Geofencing and LocationManager. Geofencing has really tidy examples and bugs , so i prefered LocationManager. Everyting works fine in LocationManager except one. If you add your current location as ProximityAlert , it immediatly fires "ENTERING" , but it is my current location , it doesnt mean that i entered this region. Because of that , it fires "ENTERING" each time i

LocationManager don't get the right results

时光总嘲笑我的痴心妄想 提交于 2019-12-29 09:41:58
问题 I am using LocationManager to convert from lat,longi to get the city name, but I am getting wrong results, I think there is something wrong in this code here: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); // Initialize

Unable to get longitude and latitude in android

不打扰是莪最后的温柔 提交于 2019-12-25 04:03:40
问题 I am developing android app to get my current longitude and latitude from GPS. I have the following code public class setting extends Activity { TextView longval; TextView latval; @Override public void onCreate(Bundle savedInstanceState){ /** Called when the activity is first created. */ super.onCreate(savedInstanceState); setContentView(R.layout.setting); longval = (TextView)findViewById(R.id.longitudefield); latval = (TextView)findViewById(R.id.latitudefield); LocationManager

IOS Location Update with NSTimer [duplicate]

左心房为你撑大大i 提交于 2019-12-25 02:47:36
问题 This question already has answers here : iPhone CLLocationManager updates every 0.5 seconds (2 answers) Closed 5 years ago . I want to get location updates exactly once per second. This interval is important for an animation I want to create to keep true-to-life speed over the ground. I understand that [myLocationManager startUpdatingLocation] will automatically poll "didUpdateToLocations", but it is not quite exactly once per second. Is there any way to use NSTimer to get my location exactly

Android locationManager Null Pointer Exception? (how to pass the context?)

两盒软妹~` 提交于 2019-12-25 02:24:10
问题 I have a problem here and I cant get it to work... I want to get the latest gps positions but all i get is an null pointer exception. It works with the first class GPSActivity but not with the 2nd SmsReceiver. I read that this is maybe because I have to pass the Context to the 2nd class but I dont know how... please help! Here comes the code: GPSActivity.class : import android.app.Activity; import android.content.Context; import android.location.Location; import android.location

need a BETTER way for current location

纵然是瞬间 提交于 2019-12-25 01:10:28
问题 Through nearly all problems/answers here and on the web, the best way for current location is as follows: if ( mLocationManager==null ) mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Location l; for ( String provider : mLocationManager.getAllProviders() ){ mLocationManager.requestLocationUpdates(provider, 1000, 1, locationListener); l = mLocationManager.getLastKnownLocation(provider); if ( isBetterLocation(l, currentBestLocation) ) currentBestLocation = l; } normally

Self Location Manager Delegate error in Xcode 6

夙愿已清 提交于 2019-12-24 17:00:02
问题 I'm using code from: http://www.veasoftware.com/tutorials/2014/6/17/xcode-5-tutorial-ios-7-simple-compass-app In Xcode 6 I get the error below. The app still runs, but this error is really annoying me. self.locationManager.delegate = self; //Assigning to 'id<CLLocationManagerDelegate>' from incompatible type 'ViewController *const __strong' 回答1: I guess you forgot to comply with the Core Location Delegate protocol by adding <CLLocationManagerDelegate> after @interface in the header file. 回答2:

Get current coordinates

杀马特。学长 韩版系。学妹 提交于 2019-12-24 15:54:42
问题 Im writing an application that supposed to send coordinates in an SMS, but I've been struggling a bit with understanding how to get the coordinates. At the moment I'm using this LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); longitude = location.getLongitude(); latitude = location.getLatitude(); And then i pass the long and lat into the text, but this only gives me the last know

Getting longitude and latitude takes a very long time

梦想与她 提交于 2019-12-24 12:07:36
问题 I am getting the longitude and latitude of my device, but it takes at 30 seconds to a minute to do so. Any suggestions to cut the time down? public class MainActivity extends Activity { public String zipcode; public double latG; public double lonG; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); boolean enabled = service