Launch App From SpringBoard dylib

Discussion in 'iOS Development' started by frankmarco, Aug 20, 2010.

  1. frankmarco

    frankmarco New Member

    Joined:
    Aug 20, 2010
    Messages:
    10
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    hello,
    I have been playing around with SpringBoard Hooking thanks to some of the tutorials on this site.
    i have the ability hi-jack the lock (power) button so that when it is pressed a UIAlert pops up.
    What I would like to do, is have an app launch when this button is pressed.
    I looked through the SpringBoard.h class dump and couldn't find a way to do this.
    I also tried using an app URL to try something like:
    [[UIApplication sharedApplication] openURL: [NSURL URLWithString: @"myapp://"]];

    This method works when called from an app already running, however when I press the lock button with no apps running, the home screen freezes.
    Any thoughts or suggestions?

    Thank You.
  2. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    There a few ways to do that. See SB(Application)Icon and SBIconModel for one of them.
  3. frankmarco

    frankmarco New Member

    Joined:
    Aug 20, 2010
    Messages:
    10
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    Hello Axis,
    Thank You for your quick reply. I am quite a newbie at this. Do you think you could provide a little more detail?

    Here is the method in my hook dylib that is called when the lock button is pressed:

    static void __$LockButtonHook_Hijack(SpringBoard<LockButtonHook> *_SpringBoard)
    {

    lets just say the app I want to launch is called "myapp". What would I put in here?
    }

    BTW, when I say my app is called "myapp" that is the name on the home screen. Is there some other reference to the app I need to use?
  4. qwertzuiop

    qwertzuiop New Member

    Joined:
    Jan 16, 2009
    Messages:
    139
    Likes Received:
    0
    Device:
    2G iPod touch
    why dont you just use activator?

    or didnt i get something here?

    Please Register or Log in to view images

  5. frankmarco

    frankmarco New Member

    Joined:
    Aug 20, 2010
    Messages:
    10
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    Thank You qwertzuiop!
    The only problem is I need to fully take control of the button. Unfortunately Activator still seems to process the powerDown event if the button is held long enough. I need to prevent that from happening.
  6. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Building MS extensions is definitely not for newbies.

    Axis pointed you in the right direction already, if you can't work it from there, you should probably start learning with apps.

Share This Page