2

I have this code

 ToneGenerator tg=new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
 tg.startTone(ToneGenerator.TONE_CDMA_ONE_MIN_BEEP, 5000);

works fine but the playing of the beep is very shot (around 200ms)

No matter if I set 5000ms or more for the duration , still nothing changes :(.

Is it possible to have control on the duration of how long the beep is played ?

//this is the definition of the function defined in android
public boolean startTone (int toneType, int durationMs)
Lukap
  • 31,523
  • 64
  • 157
  • 244

1 Answers1

0

I think that the problem is the tone you used: TONE_CDMA_ONE_MIN_BEEP is a beep of duration 400 ms (link)

You should use a beep (you can find some on the page I linked) that is continuous or lasts at least 5000 ms.

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Tiralka
  • 41
  • 1
  • 6