Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-03-2008, 04:51 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default how to make ur application to run in background

any idea... :?:

about how to make your application keep running in the background if the user click the menu button...

looking forward for kind response...

take care
i.d3v1l is offline   Reply With Quote
Old 07-03-2008, 06:13 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 355
Bucky is an unknown quantity at this point
Default Re: how to make ur application to run in background

It isn't possible to have background processes on the iPhone/iPod touch, since the system will only allow one application running at once.

There is a compromise though. Apple has announced a system for apps like IM apps that want to alert you to a new message. The iPhone will keep a constant IP connection to Apple, and the IM server will keep a constant connection to Apple. When a new message is sent, Apple will push it out to the phone, even though the IM app is not running. More details can be found here:

http://events.apple.com.edgesuite.net/0 ... index.html
Skip to 54:30
Bucky is offline   Reply With Quote
Old 07-03-2008, 06:15 AM   #3 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 4
Zaph is an unknown quantity at this point
Default Re: how to make ur application to run in background

According to Apple that is not allowed. It may be possible in jailbroken applications but I rather doubt that will be a large number of phones after the AppStore opens. Apple is providing notification services which will provide what most applications need in place of background apps.

It is also a bad idea for several reasons including battery life and non-transparency to the user--the last thing I want is several apps running in the background that I am not aware of sucking battery life. It is also bad from a security view point, it would allow key loggers and other spying apps.
Zaph is offline   Reply With Quote
Old 07-04-2008, 02:28 AM   #4 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default Re: how to make ur application to run in background

thanx for your kind responses, well

i mean to say that if i m writing some MEDIA PLAYER sort application...

it should be keep playing some music file in the background same like the iPod do...

any idea about it?...



looking forward for your kind response...

take care
i.d3v1l is offline   Reply With Quote
Old 07-04-2008, 07:04 AM   #5 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 355
Bucky is an unknown quantity at this point
Default Re: how to make ur application to run in background

I still don't think that's possible, since unlike Apple's iPhone apps, the 3rd Party Apps are sandboxed, so cannot run a background process.

I don't know whether its possible to call the iPod app, like you can call Safari, Youtube, Mail, etc. I wouldn't get your hopes up though
Bucky is offline   Reply With Quote
Old 07-05-2008, 12:39 PM   #6 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 91
CaptainCode is an unknown quantity at this point
Default Re: how to make ur application to run in background

It doesn't matter what kind of application you make, it can't be done.
CaptainCode is offline   Reply With Quote
Old 07-05-2008, 05:23 PM   #7 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 15
chrism238 is an unknown quantity at this point
Default Re: how to make ur application to run in background

Quote:
Originally Posted by CaptainCode
It doesn't matter what kind of application you make, it can't be done.
Sorry for these basic questions, my experience is only with 1.1.4, not the SDK, but the statements that background apps are impossible are pretty hard to believe. Perhaps posters are just pleading the Apple party line, but have Apple really removed the fork/exec/setsid system calls from 2.0? I seriously doubt it.

Surely apps can (still) run in the background - the challenge is being able to connect with them again at a later date, but even that is well defined in the Unix world, where a new app collects the periodically recorded state of the background app from an agreed file, removes the file, and then kills the background app.

If Bucky's statement about sandboxed apps is true, could someone please give me a pointer to what, and how, is sandboxed? Thanks,
chrism238 is offline   Reply With Quote
Old 07-05-2008, 05:44 PM   #8 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default Re: how to make ur application to run in background

Unfortunately for those looking to make a daemon style app, Apple isn't allowing any apps to run in the background. Someone, somewhere, might figure out a way to do it with the Apple-provided SDK, but Apple won't let you distribute it through the App Store even if they do. I would show you the info from the iPhone Developer site, but it's under NDA and I don't want to lose my developer enrollement by doing something stupid.
myersn024 is offline   Reply With Quote
Old 07-05-2008, 05:53 PM   #9 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 15
chrism238 is an unknown quantity at this point
Default Re: how to make ur application to run in background

Quote:
Originally Posted by myersn024
Unfortunately for those looking to make a daemon style app, Apple isn't allowing any apps to run in the background. Someone, somewhere, might figure out a way to do it with the Apple-provided SDK, but Apple won't let you distribute it through the App Store even if they do. I would show you the info from the iPhone Developer site, but it's under NDA and I don't want to lose my developer enrollement by doing something stupid.
That's OK, thanks, I can read the Developer site, too. So it's not that background apps are impossible (technically) but that Apple won't permit them in a App Store - relevant to the discussion, but very different interpretations of not possible.
chrism238 is offline   Reply With Quote
Old 07-05-2008, 10:05 PM   #10 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 91
CaptainCode is an unknown quantity at this point
Default Re: how to make ur application to run in background

Not possible with the SDK as it is and be able to install them on the iPhones without hacking them.
CaptainCode is offline   Reply With Quote
Old 07-06-2008, 06:05 AM   #11 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 15
chrism238 is an unknown quantity at this point
Default Re: how to make ur application to run in background

Quote:
Originally Posted by CaptainCode
Not possible with the SDK as it is and be able to install them on the iPhones without hacking them.
Sorry, but I find that your response doesn't really provide any explanation. In what way is it impossible? Have the Unix system calls, that I highlighted earlier, somehow been disabled by the SDK?
chrism238 is offline   Reply With Quote
Old 07-06-2008, 07:46 AM   #12 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 91
CaptainCode is an unknown quantity at this point
Default Re: how to make ur application to run in background

They might be available but like I said, you can't distribute your app if you used this and Apple found out about it. Since your app has to be signed by an Apple provided certificate you can't just do it anyways and distribute your app to everyone. Unless you want it to just play around with then there's nothing wrong with trying. Just don't expect to be able to sell or distribute any application that goes against the TOS of the SDK and the AppStore.

I have a jailbroken iPhone so I can use it in Canada and indeed it is possible but I find it highly annoying that apps such as Fring by default don't quit or behave like all the other applications by quitting when you go to the home screen. And indeed it does drain your battery much faster than having it quit.
CaptainCode is offline   Reply With Quote
Old 07-07-2008, 03:45 AM   #13 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default Re: how to make ur application to run in background

1st of all i wud like to thanx all of the respected members for their valuable suggestions...

i am also trying from my side as well...

i wud like to add some thing as...

Quote:
Originally Posted by Bucky
I still don't think that's possible, since unlike Apple's iPhone apps, the 3rd Party Apps are sandboxed, so cannot run a background process.

I don't know whether its possible to call the iPod app, like you can call Safari, Youtube, Mail, etc. I wouldn't get your hopes up though
as we can call safari, youtube or mail in our app... is it possible to use some of the facilities of these apps? like in my case in my media player can i use some features or facilities of iPod or iTunes??? not all some of them??? or can we customize them as well???

looking forward for your kind response(s)...

thanx max... take care
i.d3v1l is offline   Reply With Quote
Old 07-09-2008, 06:59 AM   #14 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default Re: how to make ur application to run in background

dear respected members... i am still looking forward for your kind response...

in regards of

Quote:
as we can call safari, youtube or mail in our app... is it possible to use some of the facilities of these apps? like in my case in my media player can i use some features or facilities of iPod or iTunes??? not all some of them??? or can we customize them as well???
plz do some help...

take care
i.d3v1l is offline   Reply With Quote
Old 07-14-2008, 02:57 AM   #15 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default

dear respected members... i am still looking forward for your kind response...

in regards of background process...

Quote:
Quote:
as we can call safari, youtube or mail in our app... is it possible to use some of the facilities of these apps? like in my case in my media player can i use some features or facilities of iPod or iTunes??? not all some of them??? or can we customize them as well???
plz do some help...

take care
i.d3v1l is offline   Reply With Quote
Old 07-14-2008, 01:32 PM   #16 (permalink)
New Member
 
Join Date: May 2008
Location: San Diego, CA
Posts: 79
cpatch is an unknown quantity at this point
Default

Quote:
Originally Posted by chrism238 View Post
Sorry, but I find that your response doesn't really provide any explanation. In what way is it impossible? Have the Unix system calls, that I highlighted earlier, somehow been disabled by the SDK?
Let's see if I can provide a detailed enough explanation for you:

1. You cannot access Unix system calls directly in the official SDK.

2. You cannot access the background process APIs in the official SDK.

3. If you were to somehow find a way around the above two limitations, Apple would catch it in the review process (which I'm sure scans for illegal API calls) and reject your application (and possibly your developer status).
cpatch is offline   Reply With Quote
Old 07-14-2008, 05:13 PM   #17 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 15
chrism238 is an unknown quantity at this point
Default

Quote:
Originally Posted by cpatch View Post
Let's see if I can provide a detailed enough explanation for you:

1. You cannot access Unix system calls directly in the official SDK.

2. You cannot access the background process APIs in the official SDK.

3. If you were to somehow find a way around the above two limitations, Apple would catch it in the review process (which I'm sure scans for illegal API calls) and reject your application (and possibly your developer status).
Thanks very much for the clarification; I do appreciate.
When you say 'cannot', do you mean 'within the terms of the developer agreement'?
If more than that, do you have any technical detail on how Apple have restricted access to Unix systems calls in the SDK, when the SDK itself is heavily dependent on them?

(bring on the jailbreaking so that such synthetic constraints may receive their due respect...)
chrism238 is offline   Reply With Quote
Old 07-14-2008, 06:59 PM   #18 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 17
AwayBBL is an unknown quantity at this point
Default

It's fairly obvious that background processing does occur (since Apple uses it for it's own apps), but in order for an app to truly run in the background it would need to be able to listen for events coming off the system queues, which Apple has not provided API's for.

The only thing that they will be providing is a server based notification service which for some apps might be OK, but NOT a substitute for real background stuff.

Let's say you built an RSS reader, and that reader could periodically check sources for updates. In a background scenario, the client could do that while running in the background, much the same way as the e-mail service checks for new E-mail. But what Apple recommends is to use their notification service (which would be a server application), to push a notification to the device. That notification could then alert the user by either modifying the home screen icon, or issuing an audible alert(or both). In terms of network utilization, the notification method is more efficient, but requires an elaborate server based process to manage the notifications.

I'd hope that at some point Apple will see the error of their ways, and open the API's to include a method to add listeners to the system queue, and support real background processing. Other OS's allow it, and so should they.
AwayBBL is offline   Reply With Quote
Old 07-14-2008, 08:02 PM   #19 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 15
chrism238 is an unknown quantity at this point
Default

Quote:
Originally Posted by AwayBBL View Post
It's fairly obvious that background processing does occur (since Apple uses it for it's own apps), but in order for an app to truly run in the background it would need to be able to listen for events coming off the system queues, which Apple has not provided API's for.
All true, but as the iPhone is a Unix-based device, your definition of 'background' is but one suitable definition. For example, an application could disassociate itself (or a child process) from the screen, and periodically just read the current WiFi signal strength or GPS information, logging these to a 'disk' file. Another interactive process could, later, find the process, kill it, and make use of the logged information. Yes, it would consume a small amount of battery, but if the logging cycle to long enough, or the activity quick enough, then that's a price I'm willing to pay.
chrism238 is offline   Reply With Quote
Old 07-15-2008, 12:11 PM   #20 (permalink)
New Member
 
Join Date: May 2008
Location: San Diego, CA
Posts: 79
cpatch is an unknown quantity at this point
Default

Quote:
Originally Posted by chrism238 View Post
Thanks very much for the clarification; I do appreciate.
When you say 'cannot', do you mean 'within the terms of the developer agreement'?
If more than that, do you have any technical detail on how Apple have restricted access to Unix systems calls in the SDK, when the SDK itself is heavily dependent on them?
I mean within the limitations of the SDK (and presumably within the terms of the developer agreement as well, since you could probably hack the SDK to allow access to the necessary APIs). As for technical detail, I think it should be fairly apparent how Apple would restrict access but you can always check out the myriad of documentation at iPhone Dev Center for further clarification. (Which you should be reading anyway if you're planning on doing any kind of development for the iPhone.)

Last edited by cpatch; 07-15-2008 at 12:18 PM.
cpatch is offline   Reply With Quote
Old 07-16-2008, 09:30 AM   #21 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default

respected members...

i would like to thanx all of you for your very informative and valuable help... regarding my problem...

i will be please to hear more on it... so if u ppl get some time as well as some more material on this to share... i will be waiting for your posts...

take care have fun

c ya
i.d3v1l is offline   Reply With Quote
Old 09-09-2008, 05:31 AM   #22 (permalink)
Tutorial Author
 
Join Date: Jun 2008
Location: Lahore, Pakistan
Posts: 34
adeem is an unknown quantity at this point
Default

i thought in September, apple is going to lunch tht push notification system, Any one have news abt that?
adeem is offline   Reply With Quote
Old 09-09-2008, 05:59 AM   #23 (permalink)
Registered Member
 
Join Date: Jun 2008
Posts: 83
i.d3v1l is an unknown quantity at this point
Default

i guess... iPhone OS 2.1 beta is released... that contain that push notification methodology...

but havent chked it...

as that OS will locked the iPhone only for development and it wont be downgradeable...

well les c wot hpns...
i.d3v1l is offline   Reply With Quote
Old 09-09-2008, 07:57 AM   #24 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 12
johnnycannuk is on a distinguished road
Default OT....

Quote:
Originally Posted by i.d3v1l View Post
well les c wot hpns...
Ok, nit picking here and completely OT:

For the love of Zues, its 2008 and I must assume you are typing this on a full blown computer, drop the lame-assed sms syntax when typing in posts.

They keyboard is big enough, there is enough physical memory and disk space - you don't need to save time or space by dropping vowels and misspelling words.

I cannot speak for others, but to me, this does not make you look 'cool' or 'hip' - in makes you look borderline retarded and not very serious about development. I have a lot of programming experience in all sorts of areas (over 10 years and 5 languages) and I will not provide help to morons that post like that.

Now, call me a curmudgeon if you like, I don't particularly care - just know that sloppy illegible nonsense writing in posts will probably not get the quality of the answer you want.

/rant off.
johnnycannuk is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UILabel background color mademo iPhone SDK Development 3 02-10-2010 09:04 AM
Did you guys make the deadline? BeyondtheTech iPhone SDK Development 4 07-09-2008 09:34 PM
What in a XIB would make my app switch to portrait? bronxbomber92 iPhone SDK Development 0 06-21-2008 12:59 PM
Launch mail application from an iphone application satyanarayanagv iPhone SDK Development 1 06-12-2008 03:04 AM
UIColor with background view Senly iPhone SDK Development 3 04-22-2008 08:59 AM


» Advertisements
» Online Users: 327
6 members and 321 guests
blueorb, guusleijsten, Kryckter, LEARN2MAKE, n00b, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:55 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0