Send Post request when new core motion activity is detected while app is in background mode

Hi, I'm looking for a way to send a post request to my server whenever my iOS app gets an update from core motion activity manager about user's current activity type.
I want this to happen when the app is in both the foreground and the background mode.

Because my app also involves playing music player, I was hoping to be able to make the post request mentioned above while the music is playing in background mode.

Could you please help me out and suggest ways I could make this work?

Send Post request when new core motion activity is detected while app is in background mode
 
 
Q