2

I'm looking to create an iphone app to help people monitor whether they are experiencing hearing loss from turning up the sound too high on their earbuds for a research project.

To do this, I want to periodically poll the volume level when music is playing on the iphone and the headphones are plugged in.

I did find the following answers that indicate it is possible however I am not familiar with iphone development.

checking when the audio is playing on the phone Can my app be notified when another application starts/stops playing audio?

check if headphones are plugged in Are headphones plugged in? iOS7

checking the volume level on the phone https://stackoverflow.com/a/29170927/1361960

Community
  • 1
  • 1
leeroid
  • 192
  • 2
  • 10
  • The three resources you provided are a good place to start with working against your requirements for the project. Is there something more specific that you're looking for help with? – Kevin Aleman Dec 02 '16 at 07:15
  • @KevinAleman Actually yes. I was told by a number of people that you can't do this sort of monitoring in the background and so I just want to see if that is the case, or if there are workarounds for this. This would have to be a background process since people will use other devices to play the audio (Youtube, Spotify, etc) – leeroid Dec 07 '16 at 17:35

1 Answers1

0

In Apple-way you cannot make app be notified when another application starts/stops playing audio.

Since the background execution of your app was limited according to the document.

Your code will only be executed when your application was running.

Saranjith
  • 11,242
  • 5
  • 69
  • 122