GAE already has this. Allow me to explain its syntax and how it works. Firstly, because XML snippets are worth 9001 words, feast your eyes on this!
<attack-notice enabled="true" min-delay="30">
<sound-file path="sound/attacked1.ogg" />
<sound-file path="sound/attacked2.ogg" />
<sound-file path="sound/attacked3.ogg" />
<sound-file path="sound/attacked4.ogg" />
</attack-notice>
<enemy-sighted-notice enabled="false" />
Not sure what you're looking at? Let the explanation begin!
First off all, GAE has two types of attack notices. One for if your units get attacked off screen and one for if you sight a unit off screen, but are not being attacked (I don't think this one works yet, though). Both have the exact same XML code minus the tag name itself, which is "attack-notice" and "enemy-sighted-notice" respectively. The Min delay attribute is the minimum time in seconds in which must pass before giving another warning (thus, if a battle goes on off screen, we don't get a hundred warnings from every attack, but just one. If we stay away for 30 seconds, though, we'd get another. All the sound-file tags childed inside this tag are links to the sound to play when attacked off screen (this could be drums, a battle trumpet, or your soldiers politely informing their supreme leader that they are being wasted, your choice). The first thing we note about these sounds is that there's multiple of them. This is because we can have many different sounds (as seen in the above code, military has 4) to prevent it from always sounding the same. One is randomly chosen when the "alarm" is sounded.
Hopefully that sums it up well. If not, ask any questions you may have.