Play a sound on charger unplugged from background

  1. I see many anti-theft apps already released in the App Store that have a feature to immediately play a loud sound when the charger gets unplugged.

  2. I can't find an API to make it work if the app is backgrounded, which is the main point.

How can I achieve this?

Play a sound on charger unplugged from background
 
 
Q