How to receive single tap and hold Remote-Control Event with iOS

0 votes

I'm looking for my app to listen for the single tap and hold of the play/pause button on headphones for iOS devices. Currently, the behavior is to start Voice Control (on my iPhone 4).

The event list for remote control events allows for getting the double tap and hold (BeginSeekingForward) and the release (EndSeekingForward), but I'm looking for the single tap and hold which currently activates Voice Control.

Is there a way for my app to override Voice Control and listen for the single tap and hold?


 

Nov 8, 2022 in Mobile Development by gaurav
• 23,260 points
521 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can add in a UILongPressGestureRecognizer to your UIButton and work from there.

If you want to prevent your other method from being called, you'll also need a UITapGestureRecognizer that counts taps and sets a value to true when it receives a second tap and another method (Check from your UIResponder touch* methods) for a touch release and set the value back to false.

Using that value, you can check with the UILongPressGestureRecognizer to see if the user double tapped or not.

Alternatively, you could also just have the value set to false upon a touch to the button that doesn't have a tap count of two.

Hope this helps!

EDIT: You cannot override the headphones (as far as I know) without jailbreaking the device. Normally you should never have to code for people interacting using the Apple headphones, since that would severely reduce the market and usability of your app. If someone were to forget their headphones, for example, they could not utilize your app. Its just something to think about. You don't want to limit your apps accessibility too much.

answered Dec 12, 2022 by gaurav
• 23,260 points

edited Mar 5

Related Questions In Mobile Development

0 votes
0 answers

How to receive single tap and hold Remote-Control Event with iOS?

I'm looking for my app to listen ...READ MORE

Nov 30, 2022 in Mobile Development by gaurav
• 23,260 points
358 views
0 votes
0 answers

How to fetch the width and height of a programatically added view in Swift/ iOS?

I have added a UIView and a ...READ MORE

Nov 10, 2022 in Mobile Development by gaurav
• 23,260 points
1,248 views
0 votes
0 answers

How to get original image when we zoom in and zoom out the image in ios

Hi i am beginner in ios and ...READ MORE

Nov 17, 2022 in Mobile Development by gaurav
• 23,260 points
768 views
0 votes
0 answers

How to login to a site using POST request? (Swift,iOS)

I want to create an iOS Application ...READ MORE

Nov 9, 2022 in Mobile Development by gaurav
• 23,260 points
748 views
0 votes
0 answers
0 votes
1 answer

Getting country calling prefix

For a class that offers both this ...READ MORE

answered Sep 20, 2022 in Others by Aditya
• 7,680 points
948 views
0 votes
1 answer

Is there a way to to check if a picture was taken on that iPhone?

Actually, the model and manufacturer information is ...READ MORE

answered Sep 22, 2022 in IOS by Rahul
• 9,680 points
770 views
0 votes
1 answer

Detect if the device is iPhone X

The response to your query is "no" ...READ MORE

answered Nov 8, 2022 in IOS by Rahul
• 9,680 points
1,106 views
0 votes
0 answers

How to use iOS Reachability

I'm developing an iPhone app that uses ...READ MORE

Nov 9, 2022 in Mobile Development by gaurav
• 23,260 points
635 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP