i am developing an application for iphone using iOS 4.2 SDK.
My application need to popup an alert when a user arrives a specific location (in 400m radius). Note that I need to get this alert even if the app is in the background.
When I use the locationManager with startUpdatingLocation mode, i get the alert when the app is in the foreground, but not when it is in the background.
When I try to run with locationManager with startMonitoringSignificantChanges mode, i don't get any position changes in background and even not in foreground (i.e. didUpdateLocation method is never called. only once in the application start up)
some facts:
1. I updated info.plist with UIBackgroundMode with 'location' as first item in array.
2. I updated info.plist UIDeviceCapabilities with gps and location-services (though it doesn't really matters)
3. all said above refers to running this app on the 3GS iphone device.
4. I tried this app on sdk 4.0 and 4.1 and got the same problem.
5. The device supports startMonitoringSignificantChanges use (method of locationManager confirms it)
6. When I check the app on the device i move in range of ~150 meters meters. Is the startMonitoringSignificantChanges will call didUpdateLocation method with this kind of movement?
7. All settings on the devices are turned to on mode (roaming, 3G, wifi,...)
Am i missing something? any ideas?
Thanks,
if you're still interested, have a look at that post:
Behaviour for significant change location API when terminated/suspended?
and the example project mentioned:
http://www.cannonade.net/blog.php?id=1480
Related
I have a tab based app that uses four tabs. The home tab is an MKMapView. When I load the app onto my iPhone and run from "Xcode" or "Instruments" there are no problems with crashing. However when I load the app onto my iPhone from iTunes or testflight.com it crashes whenever the MKMapView pans or zooms. Everything else in the app seems to work fine.
can you check the iOS version of simulator and device both? this might be happening due to some method or something else which might be not exist in the running version of iOS and your code might be calling that particular method.
You should debug your code while running on device and track the specific action as your were saying crashed happens when only the pan or zooming of mapview performed.
I'm working on a location based app, which needs to send coordinates to server at a defined interval. It works properly on iPhone 4, even in background(see: iOS HTTP request while in background).
A friend of mine installed it on iPhone 3G with iOS 4.2.1 and after he put the app in background, it was killed by the OS. The app has 3 screens, first is a login screen. After he returns in foreground, the login screen appears again, instead the screen he has left open(which means the app was killed and restarted upon re-launch). on iPhone 4 work as expected.
Why on iPhone 3G the app is not run in background even it is declared as location app("required background modes" is set on "app registers for location updates")?
Because on iPhone 3G, multitasking is not officially available.
(you can jailbreak the iPhone, do some plist hackery and make your iPhone 3G have multitasking, but I suppose you don't consider jailbreaking at all even if you know about it.)
All the sudden, the CLLocationManager won't start on the simulator - I observed this by finding out that the gps icon does show up on the status bar, and also no callbacks to the didUpdateToLocation delegate. What could be the reason causing this?
Add one GPX file in Xcode and in it specify Latitude and Longitude...:)
for example wpt lat="23.04472" lon="72.56839"
Did you change your simulator to version below 5.0? Because simulator version below 5.0 won't support Location Services. Also in simulator in settings make sure Location Services are enabled.
I'm trying to get the following functionality in my iPhone app:
When backgrounded, stays running (doesn't have to do any background work)
When resumed, app picks up where it was left off
I'm mainly wanting the same screen on my app still up, as there are several UINavigationControllers within a UITabBarController.
I have done all of the following:
Made sure I'm compiling with 4.1 SDK
Set UIApplicationExitsOnSuspend to false
Handle DidEnterBackground and WillEnterForeground in my AppDelegate
Call BeginBackgroundTask in DidEnterBackground, to attempt to keep my app open
I'm using MonoTouch, but that it probably beside the point. I can take answers in Obj-C, for sure.
I've tested my app on a jailbroken phone with Backgrounder, and I see the "app in background" badge disappear immediately after pushing the home button. I also tried setting UIBackgroundModes in my Info.plist, but to no avail.
Is there anything I'm missing?
Or is this something I would have to implement on my own to resume the previous state of my app? Everywhere I've read talks like it should just work automatically.
If you don't want to be doing work in background, don't call beginBackgroundTask. That call is for situations where you want to do some kind of work in the background. And if you don't finish that work fast enough, iOS will terminate your app.
When I upgraded to iOS 4.x, my MT application started exhibiting this behavior without me having to do anything. iOS should take care of it for you.
I finally got in touch with someone on MonoTouch's irc.
In MonoDevelop there is an option to make a dual iPad/iPhone project, which I used. This is causing my app to behave as if it's running with the 3.2 SDK when deployed to the device.
I think my solution is to install the iOS 4.2 SDK that just came out, since this ads the new multi-tasking feature on iPad.
Not only do you need to support going into the background, you also need to support cases where your app has been terminated. In your app’s initialization code, you should resume the state that it was in. For instance, when you push a view controller, use NSUserDefaults to store a value for the currently-displayed screen, and then when you start read that value and display the associated screen.
Here is a list of problems I have after building my app with xcode 3.2.3 and running it on simulator 4.0.
Of course, all these issues did work with the previous environment.
Location manager does not update location. It used to update with the location at Cupertino but now I get locationManager:didFailWithError: called with error 0.
I have a map view and the panning doesn't work. Moving the map around nor the pinching gesture.
When I click and hold on the map my app, sometimes, crashes and the Log says something about long touch.
Thanks,
Tzur.
The simulator no longer returns a faked location but tries to use your Mac's Airport to locate you. Do you have Airport activated?