Android ToneGenerator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ToneGenerator class.

This code example shows how to use the following methods:release, startTone, stopTone, sleep
        ToneGenerator toneGen1;
        ToneGenerator toneGen2;
        int type;
        boolean result = true;
 
        toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
        toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50);
 
        if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) {
            Thread.sleep(100);
            if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) {
                Thread.sleep(500);
                toneGen1.stopTone();
                Thread.sleep(100);
                toneGen2.stopTone();
            } else { 
                toneGen1.stopTone();
                result = false;
            } 
        } else { 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
    if(am != null){
      if(am.getRingerMode() != AudioManager.RINGER_MODE_SILENT) {
        am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:release, startTone, stopTone, sleep
        ToneGenerator toneGen1;
        ToneGenerator toneGen2;
        int type;
        boolean result = true;
 
        toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
        toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50);
 
        if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) {
            Thread.sleep(100);
            if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) {
                Thread.sleep(500);
                toneGen1.stopTone();
                Thread.sleep(100);
                toneGen2.stopTone();
            } else { 
                toneGen1.stopTone();
                result = false;
            } 
        } else { 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
        if(vib != null){
          vib.vibrate(50);
        } 
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:stopTone
		} 
	} 
 
	public void stopDTMF() { 
		nowPlaying = null;
		generator.stopTone();
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
        } 
      }else if(am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
        am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
    if(am != null){
      if(am.getRingerMode() != AudioManager.RINGER_MODE_SILENT) {
        am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
        if(vib != null){
          vib.vibrate(50);
        } 
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
        } 
      }else if(am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
        am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startTone
    if(am != null){
      if(am.getRingerMode() != AudioManager.RINGER_MODE_SILENT) {
        am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
      }else{ 
        am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
        if(tg != null){
          tg.startTone(ToneGenerator.TONE_PROP_BEEP);
        } 
      } 
    } 
    finish();
  } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android ToneGenerator Questions & Answers:

See Code Examples for Android ToneGenerator Methods: