background mode execution

Hi guys,
Can someone post an example how to use the background modes in the new xojo 2016r4.1 ?
I dont know why, but the checkboxes in the background modes panel uncheck itself after i save the project.
Im interested in :

  • playing audio while the app is in the background
  • storing data (location or data from http socket) while in the background

How to ask for permissions?
I have this in my info.plist:

[code]UIBackgroundModes
audio

NSAppleMusicUsageDescription
background music permission[/code]
I had to add this plist to the ide, because the background mode checkboxes did nothing.

Any help is appreciated

[quote]I have this in my info.plist:

[code]UIBackgroundModes
audio

NSAppleMusicUsageDescription
background music permission[/code]
I had to add this plist to the ide, because the background mode checkboxes did nothing.[/quote]

Hi Roland,
I can’t give you much help on the background music side of things but in my experience with setting UIBackgroundModes in info.plist I needed to put the permission key into an array in order to make it work - even if I only wanted one of the keys:

<key>UIBackgroundModes</key> <array><string>audio</string></array>

or for multiple permissions:

<key>UIBackgroundModes</key> <array><string>fetch</string> <string>remote-notification</string></array>

This worked for me!

And yes you are right, the check boxes in the IDE do nothing - not sure if there is a bug reported for this. I found they did not even reliably ‘stick’, e.g. if you clicked Fetch and then saved your project it would not always be checked when you opened the dialog again at a later stage.

Thank you for your response, but I can’t make it work. I used the code you suggested, its in the info.plist file. But I should ask the user to give permissions, how should i do it?

In case you are unsure if a bug report exists, please file one! If it should be a duplicate, it will be combined with the existing one. In any case it’s better to have two than none.
Thank you!