Java Code Examples for android.media.ToneGenerator#startTone()
The following examples show how to use
android.media.ToneGenerator#startTone() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MqttSettingsCodeReaderFragment.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 6 votes |
@Override public void onCodeScanned(String contents) { Log.d(TAG, "Code Scanned: " + contents); if (isCodeAlreadyScanned) { return; } // To avoid double scans and pop 2 times the fragment isCodeAlreadyScanned = true; // Beep final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); tg.startTone(ToneGenerator.TONE_PROP_BEEP); // mListener.onPasswordUpdated(contents); // Pop current fragment FragmentActivity activity = getActivity(); if (activity != null) { FragmentManager fragmentManager = activity.getSupportFragmentManager(); fragmentManager.popBackStack(); } }
Example 2
Source File: OpenFitService.java From OpenFit with MIT License | 6 votes |
public void run() { long timeStart = Calendar.getInstance().getTimeInMillis(); Log.d(LOG_TAG, "FindSound Start: "+timeStart); ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, ToneGenerator.MAX_VOLUME); while(isFinding) { try { long timeDiff = Calendar.getInstance().getTimeInMillis() - timeStart; Log.d(LOG_TAG, "Sound time: " + timeDiff/1000); toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200); // 200 ms tone Thread.sleep(600L); } catch(InterruptedException ie) { Thread.currentThread().interrupt(); return; } } }
Example 3
Source File: CallActivity.java From Yahala-Messenger with MIT License | 5 votes |
@Override public void onCallHangUp() { WebRtcPhone.getInstance().AnswerCall(); disconnect(); ToneGenerator tg2 = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, 100); tg2.startTone(ToneGenerator.TONE_PROP_BEEP2); }
Example 4
Source File: MqttUartSettingsCodeReaderActivity.java From Bluefruit_LE_Connect_Android with MIT License | 5 votes |
@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(); }