@Override public void onScanCompleted(String path, Uri uri) { beeper.startTone(ToneGenerator.TONE_PROP_NACK); } }
ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); tg.startTone(ToneGenerator.TONE_PROP_BEEP);
@Override public int onStartCommand(Intent i, int flags, int startId) { if (i.getAction()==null) { resultCode=i.getIntExtra(EXTRA_RESULT_CODE, 1337); resultData=i.getParcelableExtra(EXTRA_RESULT_INTENT); foregroundify(); } else if (ACTION_RECORD.equals(i.getAction())) { if (resultData!=null) { startCapture(); } else { Intent ui= new Intent(this, MainActivity.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(ui); } } else if (ACTION_SHUTDOWN.equals(i.getAction())) { beeper.startTone(ToneGenerator.TONE_PROP_NACK); stopForeground(true); stopSelf(); } return(START_NOT_STICKY); }
void processImage(final byte[] png) { new Thread() { @Override public void run() { File output=new File(getExternalFilesDir(null), "screenshot.png"); try { FileOutputStream fos=new FileOutputStream(output); fos.write(png); fos.flush(); fos.getFD().sync(); fos.close(); MediaScannerConnection.scanFile(ScreenshotService.this, new String[] {output.getAbsolutePath()}, new String[] {"image/png"}, null); } catch (Exception e) { Log.e(getClass().getSimpleName(), "Exception writing out screenshot", e); } } }.start(); beeper.startTone(ToneGenerator.TONE_PROP_ACK); stopCapture(); }
void start() { recorder=new MediaRecorder(); recorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); recorder.setVideoFrameRate(config.frameRate); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); recorder.setVideoSize(config.width, config.height); recorder.setVideoEncodingBitRate(config.bitRate); recorder.setOutputFile(output.getAbsolutePath()); try { recorder.prepare(); vdisplay=projection.createVirtualDisplay("andcorder", config.width, config.height, config.density, VIRT_DISPLAY_FLAGS, recorder.getSurface(), null, null); beeper.startTone(ToneGenerator.TONE_PROP_ACK); recorder.start(); } catch (IOException e) { throw new RuntimeException("Exception preparing recorder", e); } }
// send the tone to the "alarm" stream (classic beeps go there) with 50% volume ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 50); if (val >= taux_max) { taux_text.setTextColor(warnning_col); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); // 200 is duration in ms }
//declaration ToneGenerator toneG; //using any where` if(val>=taux_max) { taux_text.setTextColor(warnning_col); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); //200 is duration in ms }
public void playTone(int tone, int duration) { mToneGenerator.startTone(tone, duration); }
if(maintext.equals("10")) { ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); }
ToneGenerator toneGenerator= new ToneGenerator(AudioManager.STREAM_DTMF,ToneGenerator.MAX_VOLUME); //this will play tone for 2 seconds. toneGenerator.startTone(ToneGenerator.TONE_DTMF_1, 2000);
public class MySpeechRecognizer implements RecognitionListener { public void initialize() { //... other SpeechRecognizer initialization mSpeechRecognizer.setRecognitionListener(this); } @Override public void onReadyForSpeech(Bundle params) { final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_MUSIC, 100); tg.startTone(ToneGenerator.TONE_PROP_BEEP); } //... other required methods of RecognitionListener }
ToneGenerator toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100); toneGen1.startTone(ToneGenerator.TONE_CDMA_PIP,150);
ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, ToneGenerator.MAX_VOLUME); tg.startTone(ToneGenerator.TONE_PROP_BEEP);
ToneGenerator toneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, 100); toneGenerator.startTone(ToneGenerator.TONE_CDMA_NETWORK_USA_RINGBACK, 1000);
public void playTone(int tone) { if (tone_gen.startTone(tone)) { try { Thread.sleep(100); tone_gen.stopTone(); } catch (InterruptedException e) { e.printStackTrace(); } } }
ToneGenerator dtmfGenerator = new ToneGenerator(0,ToneGenerator.MAX_VOLUME); dtmfGenerator.startTone(ToneGenerator.TONE_DTMF_0, 1000); // all types of tones are available... dtmfGenerator.stopTone();
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int volume_level= am.getStreamVolume(AudioManager.STREAM_RING); // Highest Ring volume level is 7, lowest is 0 final ToneGenerator mToneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, volume_level * 14); // Raising volume to 100% (For eg. 7 * 14 ~ 100) mToneGenerator.stopTone(); mToneGenerator.startTone(ToneGenerator.TONE_DTMF_1, 100); // play sound for 100ms
@Override public void onCodeScanned(String contents) { Log.d(TAG, "Code Scanned: " + contents); // Beep final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); tg.startTone(ToneGenerator.TONE_PROP_BEEP); // Intent data = new Intent(); data.putExtra(kActivityResult_ScannedContents, contents); setResult(RESULT_OK, data); finish(); }
@Override public void onLongPress(final LatLong tapLatLong, final Point thisXY, final Point tapXY) { Toast.makeText(this.getActivity(), this.getActivity().getString(R.string.saved_waypoint) + "\n" + tapLatLong.toString(), Toast.LENGTH_LONG).show(); final DataHelper dbHelper = new DataHelper(getActivity().getApplicationContext()); final PositionRecord pos = new PositionRecord(GeometryUtils.toLocation(tapLatLong), mSessionId, RadioBeacon.PROVIDER_USER_DEFINED, true); dbHelper.storePosition(pos); // beep once point has been saved ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); }