Is there a way to manually tell the device to dispatch a significant location change notification that will wake up any applications registered for this notification? This is for testing only, and I realize this private API call would get rejected upon submission to the app store.
in iOS Simulator menu, go to Debug -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly.
When changing the timezone, I found the easiest way to do it was by clicking the clock in the menubar. And then selecting "Open Date & Time Preferences" then select the tab Time Zone. Alternatively System Preferences -> Date and Time and select the tab Time Zone.
In some Android versions, you have to put a check in the box next to the Allow mock locations option on the Developer options screen. Use the back button to return to the app, and search for the location you want to fake on your phone. If you're making a route, tap-and-hold on the map to drop place markers.
So two answers:
A) Hop on a train :-)
B) Use the simulator. In iOS 5.x simulator, there is a debug menu that has a location submenu. Choose freeway drive. This will start the simulator on an imaginary journey down the scenic 280 in Northern California. It gives you everything but the view: your app will get Significant Location Change updates, and will also be launched in the background if it has been suspended.
To verify that you are actually moving, launch safari in the simulator, and go to maps.google.com and click the little track my location button. You should be moving.
Awesome! Now how to debug the lifecycle problem of being launched by the system? Easy! Have xCode wait for your app to be launched to start debugging. From the Scheme menu, choose edit scheme. In the Run Scheme, and the Info tab, for the "Launch" setting choose : "Wait for My.app to launch".
Run your app once in the simulator, so that it starts monitoring for location updates, then force quit it, so that it is suspended. Add a break point in your application did finish launching function, and wait. As soon as your simulator has gone far enough, your application will be woken up, your breakpoint hit, and you are in the money.
But really, the train ride is more fun.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With