I think instead of using alarm manager you can use a countDownTimer as follows
new CountDownTimer(15000, 3000) {
@Override
public void onTick(long arg0) {
// Your code here
}
@Override
public void onFinish() {
// your code here
}
}.start();
This count down timer will work for 15 seconds (5*3sec) with an interval of 3 seconds. You can use onTick() to write your code to execute in each 3 seconds and onFinish() to write the code for finishing the timer after 5 intervals.