-2

How to create an Android app to give a beep sound before approaching the 1 min mark (Say at 45 sec, just a beep to let the user knowing, 15 sec before it passes a min)?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

2

You can use the native MediaPlayer for this purpose.

  new CountDownTimer(//put time required here) {

    @Override
    public void onFinish() {
        timeUp();
    }

    @Override
    public void onTick(long millisUntilFinished) {
        //get time remaining here
    }

}.start();

Create an Uri using Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

and then a ringtone - and call play().

sarnabtech
  • 486
  • 3
  • 12