Is it currently possible to create an app that "reminds me when I get to work, Siri" right now ? Or the app needs to be running to apply geofencing ?
Yes, it is possible by using the CLLocationManager's startMonitoringForRegion
which will call your App when entered/left a certain "fenced" geo-area.
BUT since the user's location is/will be used, the location icon will appear for as long as this call has yet been canceled (by the matching stopMonitoringForRegion)
(on iOS6 this icon will be replaced with a different location icon for "regional" location instead of regular location use - looks like an outline of the current icon)
Related
Anyone know how to show the "blue pulsating dot" for the user devices location on watchOS InterfaceMap element?
In iOS this can be done to MKMapView by calling mapView.showsUserLocation = true. InterfaceMap for watchOS doesn't seem to be supporting this and I was wondering if there is some other way to do this. Of course this could be done manually by placing an annotation on the user location every time the location is updated, but it seems a bit clunky and it would be great to have the default blue marker for the user location.
Thank you
You cannot do this on watchOS. WKInterfaceMap can only be used to show a static piece of the map at the moment. WKInterfaceMap shows a noninteractive map for a specific location. You can change the location shown on the map dynamically, but there are no built-in methods to update it automatically to show the user location in contrast to what MKMapView can achieve.
I am using GeoFencing to set a region and perform some task when user Enters or Leaves the region. Bt it is not working for me, i am using gollowing code
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(some values,some values);
CLRegion *region = [[CLRegion alloc]initCircularRegionWithCenter:coord radius:15.0 identifier:#"SF"];
[locationManager startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyBest];
But None of the delegates didEnterRegion and didExitRegion being called when i close the application and the app is monitoring and i move away from that region or enter.
You define a radius of 15m. That is too small. First, try with 50m or more. Look at the map app, if you really have entered that region.
Furthermore, I hope you meant "send to background", instead of closing.
make sure you have set your app to be allowed to run in background? (via plist)
Update:
Finally it turned out that you terminated the application. Then of course you will not get any loctaion events anymore.
Solution:
Don't terminate it via double click on home button follwed by selecting the white cross, simply close it with one click on home button, then it has chance to run in background.
Update2:
Even when the app was terminated, ios relaunches it when it has registered to the location monitoring service:
from CllLocationManager Class Reference
If you start this service and your application is subsequently
terminated, the system automatically relaunches the application into
the background if a new event arrive...
Add CLLocationManagerDelegate in header file.
make sure u added
locationManager.delegate = self;
try increasing the radius and check.
First of all increase the radius you are giving for that particular location and check again if it does not work then by following some easy steps provided in this tutorial you can easily implement Geo-Fencing in your app.
Reference: Apple Documentation
You define a radius of 15m. That is too small. First, try with 50m or more. Look at the map app, if you really have entered that region.
Furthermore, I hope you meant "send to background", instead of closing.
make sure you have set your app to be allowed to run in background? (via plist)
My app runs significant location change updates in the background. However the GPS display icon never turns off..even when app is in the background. Is there a way to use location manager with Significant location change in the background and have the GPS icon NOT display continuously? My users don't understand that it is only periodically obtaining location coordinates and instead think its constantly running in background and thus deleting app thinking its too power intensive. Please help.
I believe that any use of CoreLocation will prompt the location arrow. That includes any of the geofencing CLRegion use, -startMonitoringForSignificantLocationChanges, and -startMonitoringForLocation. I think that is Apple's safeguard that something is using your GPS, even in limited use.
That arrow will be visible till you unregister your application from significant change. But I faced problem, what I can't fine point where I can do this. In my case will be best to unregister on application kill, but with multitasking there is no such ability to handle this moment to unregister.
I am storing Location settings in the settings bundle. So when I flip a switch to NO, my app stops the background location service.
I am using an observer to detect settings change, and updating a flag in my app. The problem is, if I flip the switch to OFF, my app does not stop the location service till I open the app. This is understandable, since my observer resides in the source code. Is there a way to listen for the settings while the app is in the background? I am an iOS development newbie, so I do not understand the concept of background and foreground so much.
Its not possible is what I found.
is it possible to change the iPhone background from code?
If you write a new png to /User/Library/LockBackground.png and then call notify_post(" com.apple.language.changed"); the device will respring and your new background will be present.
This isn't technically a private API, but does fall outside of what Apple allows on the store.
Nope, you can only save a picture for the user to set as a background.
Mel is correct, there's no way to skip over the save process.
The reason this will always be the case:
Apple doesn't want apps to be able to set the background immediately upon opening. Theoretically, they could have a permission box (like the location dialog), but I doubt that will happen anytime soon.