i want to make physical button a trigger for a function in my app. Possible?

Discussion in 'iOS Programming' started by manOtunes, Feb 22, 2010.

  1. manOtunes macrumors newbie

    Joined:
    Feb 22, 2010
    #1
    Hello,

    I'm currently working on an app for iPhone, Blackberry and Android, but for now, I'm just inquiring about iPhone. (FYI, I'm an ideas guy; not an actual programmer, so please don't use too many syllables)

    I desperately need the ability to incorporate the physical button from the iPhone headphones, into my app. So that, while my app is running, if the user clicks and holds the button for a designated amount of time, it triggers a specific function in my app. (as opposed to the functions it currently triggers in the apple API)

    As you're aware, the button currently triggers functions within the standard iPhone API. Is it possible, within a third party app, for the app to utilize that button for its own purposes?

    (If not, I must say that's incredibly infuriating and slightly fascistic, for a perfectly usable and highly useful external button to be in all the user's pockets, yet developers have no access to it)

    Or, if it is impossible to use the headphones-button to launch a function in a 3rd party app, is it at least possible to purchase some sort of third party (or apple) physical button which can be incorporated into an app?

    Hopefully I've been clear. In other words, is there a physical, external button product on the market which somehow connects to the iPhone, (perhaps via bluetooth) which the user can clip to their belt, and while my app is running, this button triggers a function within my app, when pressed?

    If any of you kind people can help me with this urgent question, you will literally save my app.

    Thanks so much in advance!!!!!

    man'Otunes
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    No. The Home Button cannot be used by an app in any way.

    You could develop and have manufactured some sort of external accessory that plugs into the Dock Connector that your app could talk to. To do this you need to talk to Apple: you would need to join the Made for iPod/Works with iPhone programs.

    I would note that in general this is not the way that iPhone apps work and is pretty much against the iPhone HCI Guide.
     
  3. sparky7 macrumors member

    Joined:
    Jul 10, 2008
    #3
    I think their talking about the headphone button..
     
  4. manOtunes thread starter macrumors newbie

    Joined:
    Feb 22, 2010
    #4
    looking to use either the headphones button or external accessory

    That's right. I'm aware that it isn't possible to program the Home button. I'm looking to either program the button which is attached to the headphones, or for a low cost physical button which connects via bluetooth.

    I'm looking to make it so, when the user presses the button while my app is running, the button triggers a function inside my app.

    Does anyone know where I can look for such a product?
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    The buttons on supported headphones are not available to the application. Again any external accessory, whether connected via Bluetooth or via the Dock, would need to go through the program I linked to above.
     
  6. manOtunes thread starter macrumors newbie

    Joined:
    Feb 22, 2010
    #6
    off the shelf?

    It seems way too ambitious for me to manufacture a dedicated accessory. I'm hoping that some third party company already exists, which created and sells already-approved bluetooth physical buttons, for use with iPhone.

    Is there such a company already in existence?
     
  7. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    I have never heard of one. As I noted iPhone apps, if they are following the HCI (which you pretty much have to do to get approved for the store) are designed to not need such a thing.
     
  8. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #8
    Apple's accessories program is called MFI, Made For IPhone. Google 'made for iPhone' to see if you can find something relevant.
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
  10. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #10
  11. fishkorp macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #11
    You can use the volume rocker on the phone to do things. Some camera apps use the volume rocker as a shutter button.
     
  12. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #12
    Try adding an audio session property listener for kAudioSessionProperty_CurrentHardwareOutputVolume and see what happens when you change the volume using the volume rocker.

    There are a whole bunch of other properties mentioned in the audio session headers. Try listening to all of them and see if any of them trigger when you do something interesting.
     
  13. manOtunes thread starter macrumors newbie

    Joined:
    Feb 22, 2010
    #13

    Thanks for that. Haven't found what I'm looking for yet but that was a helpful lead.
     
  14. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #14
    Can you explain why this needs to be a physical button and can not be done with a on-screen button?
     

Share This Page