Rx with timer looks like the way to go. If you are not up for it Handler could work as well.
Asked
Active
Viewed 1,634 times
1 Answers
1
You can try using :
TimerTask scanTask;
final Handler handler = new Handler();
Timer t = new Timer();
public void playBeep(){
scanTask = new TimerTask() {
public void run() {
handler.post(new Runnable() {
public void run() {
repeatBeep();
}
});
}};
t.schedule(scanTask, 10000, 10000);
}
public void repeatBeep(){
mp.start();
}
and call t.cancel() when you want to stop the beep

chetna
- 94
- 5