0

Rx with timer looks like the way to go. If you are not up for it Handler could work as well.

http://reactivex.io/documentation/operators/timer.html

1 Answers1

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