What happens to my app when Home is pressed

Hi…

Like most of us I am new to iOS and I am struggling with some concepts.

My app includes a timer that displays a count-down clock in a View. As it counts down, at specific times, the app plays some brief sounds… it also sends a small amount of data out via a TCP socket…

When I run the app in the simulator and click the Home button, the sounds continue to play and the data is sent on schedule. So I believe my app is running in some “background” mode… But when I run the app on my iTouch and hit the Home button, the sounds do not play and the data is not sent.

Can someone explain what is going on and the differences between the simulator and the device… and is there a way to keep my app “running” once the Home button is pressed?

Thanks…

The simulator isn’t doing the suspending properly I’d bet.
Remember its a simulator and so there are places where it will for certain differ from an actual device.

What’s an iTouch? I don’t see it on the product listing.
Only certain actions can be performed while your app is in the background from the user pressing the home button. These apps you’ll see because the time bar at the top becomes twice as tall and becomes green or red depending on the action.

If you’re running a timer app, a workaround would be to set a property for the finish time if Xojo iOS has some kind of timestamp ability, and then update your UI reflecting the math of the difference between now and that end time.

Background tasks are possible in Objective-C, but I do not see how Xojo could achieve that. When the home button is pressed, normal apps are simply suspended.

I bet he is meaning iPod Touch :wink:

Background Execution on Apple’s developer pages. There are limited situations where Apple allows apps to continue in the background.

I created a reading timer that saves the start time, so it can continue to calculate the elapsed time when the user returns to the app.

I suppose that’s the other direction from my recommendation (which counts down to a time, as yours counts up) :stuck_out_tongue:

You could add a Feedback case for an App.DidEnterBackground event.

Thanks for all the comments…

Yes, I was actually referring to an iPod Touch… (a really under appreciated Apple product… it is the iPhone equivalent of a “wifi only” iPad)…

My count down timer works just fine when the app is suspended/in background… since it it based on the actual time-of-day… My problem is that I need the app to play the sound at a specific time even if the app is in background.