Just an idea (only if you have to test ONE AA battery):
R1/R2 make a voltage divider: 1/2 of Vcc
RL is the battery load (about 1mA)
When no battery is connected A/D reads 1/2Vcc
When battery is connected A/D reads 1/2Vcc+1.5V or 1/2Vcc-1.5V
Voltage range of the A/D converter is in range (if Vcc is from 3.3V to 5V) and you can determine if battery is in correct or wrong position.
As a bonus your battery is checked with a load (1mA)