0

I have ios app ( phonegap ) , the idea of my app to detect if there is headsrt , record and play audio , the problem of my app its only work in background .

When I click record button when the app in foreground , its did not do any thing , but when I press home button and go to back ground , every thing work .

Also I have put test button , when I click it , it should alert u with message , the message not appear only if I press home button and then come back to foreground .

Please note it was work perfectly in ios 9

But in ios 10 not work

Summary : The application only work if its in background , but in foreground not work ,.

qamooos
  • 93
  • 6
  • I'm afraid this is probably too hazy for anyone to provide a useful answer. Have you done any debugging? What happens when you press the button and it doesn't work? Have you tried to log when the app starts and stops recording? – Pekka Nov 29 '16 at 07:41
  • It dose not respond to the button in foreground . It will respond when I press home button – qamooos Nov 29 '16 at 07:47
  • Have you done debugging to see whether it's actually the *button* not responding, or the code behind the button going wrong? – Pekka Nov 29 '16 at 08:01

1 Answers1

2

Your app is behaving like this because of the change in behaviour of the Content-Security-Policy meta tag in the iOS 10 UIWebView. One of the side effects is that plugin invocations are not executed until the app is put into the background (i.e. pressing the "Home" button).

You can resolve this by updating the Content-Security-Policy meta tag to add the gap:// protocol - see my answer to this question for details.

Community
  • 1
  • 1
DaveAlden
  • 30,083
  • 11
  • 93
  • 155
  • Need more upvotes, I'm searching for almost 2 hours, this gap:// solve my issue with slow socialsharing on ios. – netto Oct 26 '19 at 17:29