Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8604951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:42:14+00:00 2026-06-12T02:42:14+00:00

Is it possible that my iOS app can auto-restart, each and every time the

  • 0

Is it possible that my iOS app can auto-restart, each and every time the user accesses their home screen? This is for a jailbroken device — the app is not destined for the App store.

In general, how can I make my app restart given specific user actions outside the app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:42:15+00:00Added an answer on June 12, 2026 at 2:42 am

    Accelerometer

    If all you want to do is make your app run when you encounter certain accelerometer conditions, you can use Activator for that. Activator is a great app, by Ryan Petrich, available on Cydia for free. It lets you configure your device to run any app (or toggle) whenever a certain user action is taken. That could be a home button press, power/lock button press, or accelerometer shake.

    enter image description here

    If a basic shake isn’t what you want, or you are building an app to give to many users, and don’t want them to have to setup Activator themselves, then you probably need to write some code yourself.

    For example, you could write a Launch Daemon, in addition to your main UI app, and have the launch daemon monitor the accelerometer.

    When you detect the specific kind of motion you’re interested in, you can launch your UI app with the open command. If this is just for your own use, just download the open package from Cydia. If this is for release to others, make sure your app depends on open to ensure that it’s installed. For example, if packaging in a Debian .deb package, the DEBIAN/control file might have this:

    Depends: open
    

    to make sure users installing your app will also automatically get open, which your app needs.

    Unlock

    Your other problem concerns launching the app when the user unlocks the phone. Again, I would use your Launch Daemon to listen for this condition. On iOS 5, I see this notification when I unlock the phone:

    Notification intercepted: com.apple.springboard.lockstate

    (I detected this by running the notificationWatcher utility from the command line, while SSH’d into my phone. NotificationWatcher is also available from Cydia, as part of Erica Sadun’s Erica Utilities package)

    So, I would have your launch daemon register for Darwin notifications for "com.apple.springboard.lockstate". Something like this:

    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
                                    self, // observer: can be NULL if callback doesn't need self
                                    onLockStateChanged, // callback
                                    CFSTR("com.apple.springboard.lockstate"), // name
                                    NULL, // object
                                    CFNotificationSuspensionBehaviorDeliverImmediately);
    

    where the callback function is here:

    static void onLockStateChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
        // if you need access to member data (ivars):
        MyLaunchDaemon* this = (MyLaunchDaemon*)observer;
    
        //if (userInfo != nil) {
        //    CFShow(userInfo);
        //}
        NSDictionary* info = (NSDictionary*)userInfo;
        // I'm not sure if the userInfo object has any useful
        //  description for the lock state event
    
        if (/* unlocked */) {
            // force app to open, or resume from the background
            system("/usr/bin/open com.mycompany.MyAppName");
        }
    }
    

    I see this same notification when the screen is locked, or unlocked, so you may need to have the launch daemon keep track of the locked/unlocked state, or inspect the userInfo object to see if that tells you whether this is a lock or unlock event. I’m sure there’s other ways, too.

    Update: if you want help sorting out whether the notification occurs when the screen is locked or unlocked, you can see my Update 2 in this other SO answer. notify_get_state() can be used to determine whether the event is an on, or off, event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to build an iOS app that will get user's voicemails ?
I have an app that can be accessed on mobile phones, both iOS and
Can an iOS app read a file that has been placed on that device
I have a native iOS app that can be called from Mobile Safari in
I'm looking into using PhoneGap for an iOS app so that I can utilize
I am developing an IOS app for some extra facebook features that API's can
On iOS there is this nice feature that an app developer can specify device-specific
Looking at the Facebook iOS app, one can see that when in the feed
Is it possible to write GLSL ES fragment shaders under iOS that generate multiple
Possible Duplicate: Check that an email address is valid on iOS What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.