How to run an iPhone non-GUI application in background

Discussion in 'iPhone/iPad Programming' started by Amit Jain, Dec 29, 2008.

  1. macrumors member

    Joined:
    Apr 9, 2007
    #1
    Hi All,

    While looking into the web fouond that only one application can be run at a time in iPhone. So is there any way or work around to run a non-GUI app in iPhone in Background.
    This app will continuously query certain requests to iPhone regardign some internal iPhone events.
    Thanks in advance.
    Regards.
    Amit
     
  2. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #2
    Try another forum where they discuss non-Apple-SDK development for jail-broken devices.

    .
     
  3. thread starter macrumors member

    Joined:
    Apr 9, 2007
    #3
    Thanks..
    You mean to say that this cannot be done directly using apple SDK. Is something illegal or how can jail broking help in this kind of developement. can you help in technical terms.
    I will also take your suggesstion and go to soem other forum.
    Thnx again.
     
  4. macrumors demi-god

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #4
    Per SDK guidlines your app cannot run in the background and not operate outside it's sandbox, other than by the means Apple provides. So you can access the camera, photos, and contacts, but that's about it. You can't have your app call another app or use any private frameworks. To achieve what you want you'd have to make an app for jailbroken phones, not something that would be available on the App Store.
     
  5. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #5
    In more technical terms, the stock iPhone OS runs a daemon which will kill any background user process it finds. And any app which tries to start another process won't go in the App store, since this violates term-of-use of the SDK.

    .
     
  6. macrumors newbie

    Joined:
    Jun 23, 2008
    #6
    launching application in scheduled time

    So can I write an application that will launch in a specific time and to some task ?

    Push service may be not an way here as it requires network. Is applescript the solution ?

    If you know something could u plz throw some pointer ?



    Thanks
     
  7. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    Not using the SDK no.

    There is no AppleScript on the iPhone
     
  8. macrumors newbie

    Joined:
    Jun 23, 2008
    #8
    by
    PHP:
    robbieduncan
    Did you mean to say that there is other way around ( not using sdk ) ?
     
  9. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    Probably on jailbroken phones yes, but I have no experience of that.
     
  10. macrumors regular

    Joined:
    Dec 1, 2007
    #10
    That is exactly what he meant. BUT, you will need to jailbreak your phone, and any phone you want to run this on, and it will not be allowed in the app store. For the "how" you'll need to go find a jailbreak/unofficial iPhone programming forum...
     
  11. piz
    macrumors newbie

    Joined:
    Dec 30, 2008
    #11
    If you like to run a non-GUI app in background, why instead not to use a Timer procedur that does the job?
     
  12. thread starter macrumors member

    Joined:
    Apr 9, 2007
    #12
    Actually I am trying to make an app which always will run in the background of iPhone by timer how can we do that could you plz elaborate it will really help me.
     
  13. macrumors regular

    Joined:
    Mar 13, 2008
    #13
    amit: there is no way to do that using the sdk. it's a big no-no, at least for now, and you have to live with it. we would probably have had twice as many apps in the itunes store if this feature would be acceptable, and apple would have twice as many customers calling in and complaining about the battery life.

    piz: if the application is terminated, the timer is destroyed. to keep the timer alive you would have to keep the application alive, you would have to keep the screen lit up and so on.
     
  14. macrumors newbie

    Joined:
    Jan 8, 2009
    #14
    what about plaing audio? it continue to play when I run other applications... And Apple says you can write same power applycations with their SDK as they did themself! So they are lying? :)
     
  15. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #15
    Apple apps like Mail and iPod can keep running in the background: yours can't. Whether you think that's Apple lying or not is up to you...
     
  16. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #16
    You might be able to use the SDK to write those application, but the OS won't run them, and the App store won't accept them.

    e.g. the OS will kill any user background process, but not Apple's own Mail/iPod/etc. apps. (If you boot your own phone OS, of course, all bets are off... and not a topic for this forum...)

    .
     
  17. macrumors newbie

    Joined:
    Jan 19, 2010
    #17
    Amit/chka...
    Look at some of the work done for jailborken apps like Backgrounder, aTimeTool, SBSettings, LockDown, iProtect, and other background running apps and contact those developers. They've done some very good work at managing battery life while running some small processes needed for their apps
     

Share This Page