title: ToneGenerator crash Android
body: <p>A couple of days ago, I received a crash log on my released app.</p>
  
  <p>The error comes from the ToneGenerator, and I can't find the problem.</p>
  
  <p>Here, I hava a countdown timer, when the timer reaches 0, the app launch a ToneGenerator.</p>
  
  <pre><code>private void lanceMinuteur(int temps, int color){
      if(color == 0)
          minuteur.setTextColor(getResources().getColor(R.color.color_important));
      else
          minuteur.setTextColor(getResources().getColor(R.color.color_informative));
  
      if(chronoLance){
          chrono.cancel();
      }
      chronoLance = true;
  
      chrono = new CountDownTimer((temps + 1) * 1000, 1000) {
          public void onTick(long millisUntilFinished) {
              minuteur.setText(String.valueOf(millisUntilFinished / 1000) + "\"");
          }
          public void onFinish() {
              minuteur.setText("0\"");
              minuteur.setTextColor(getResources().getColor(R.color.textcolor1design));
              chronoLance = false;
              final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);  //The error is coming from here
              tg.startTone(ToneGenerator.TONE_PROP_ACK);
          }
      }.start();
  
  }
  </code></pre>
  
  <p>And the crash log I received:</p>
  
  <pre><code>java.lang.RuntimeException: Init failed
  at android.media.ToneGenerator.native_setup(Native Method)
  at android.media.ToneGenerator.&lt;init&gt;(ToneGenerator.java:798)
  at ma.myperf.musculation.activ.GoPerformanceActivity$2.onFinish(GoPerformanceActivity.java:350)
  at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:118)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:150)
  at android.app.ActivityThread.main(ActivityThread.java:4385)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>So what can be the problem? I cheched if the ToneGenerator have a try Catch block, but there wasn't.</p>
  
  <p>I am thinking that maybe the device where the crash occured didn't have an AudioManager.Stream_Notification?</p>