Ejemplo n.º 1
0
  @Override
  public void run() {
    int counter = 0;
    while (((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getCallState()
            == TelephonyManager.CALL_STATE_RINGING
        && counter < settings.getCallerRepeatTimes()) {
      Log.v("SMN", "speak");
      speaker.speak(text);

      try {
        sleep(settings.getCallerRepeatSeconds());
      } catch (final InterruptedException e) {
        e.printStackTrace();
      }

      counter++;
    }

    context.stopService(new Intent(context, ManagerService.class));
  }