Example usage for android.media ToneGenerator ToneGenerator

List of usage examples for android.media ToneGenerator ToneGenerator

Introduction

In this page you can find the example usage for android.media ToneGenerator ToneGenerator.

Prototype

public ToneGenerator(int streamType, int volume) 

Source Link

Document

ToneGenerator class contructor specifying output stream type and volume.

Usage

From source file:Main.java

public static void startPipTone(int duration) {
    new ToneGenerator(AudioManager.STREAM_MUSIC, ToneGenerator.MAX_VOLUME)
            .startTone(ToneGenerator.TONE_CDMA_PIP, duration);
}

From source file:com.marianhello.bgloc.AbstractLocationProvider.java

public void onCreate() {
    toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}

From source file:com.tenforwardconsulting.cordova.bgloc.AbstractLocationProvider.java

public void onCreate() {
    toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);

    handlerThread = new HandlerThread("LocationProviderThread");
    handlerThread.start();//ww w  .  j ava 2 s  . c  om
}

From source file:com.tenforwardconsulting.cordova.bgloc.AbstractLocationService.java

@Override
public void onCreate() {
    super.onCreate();
    toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}

From source file:com.example.android.camera2video.CameraActivity.java

public static void logEvent(String text) {
    ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
    //        tg.startTone(ToneGenerator.TONE_CDMA_PIP,150);
    tg.startTone(ToneGenerator.TONE_CDMA_ONE_MIN_BEEP, 300);

    logText(text);//from  ww w. j a  v a 2  s. c o  m
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

@Override
protected void pluginInitialize() {
    gWebView = this.webView;

    Activity activity = this.cordova.getActivity();

    settings = activity.getSharedPreferences("TSLocationManager", 0);
    Settings.init(settings);/*from  www .ja v  a2s . com*/

    toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);

    Intent launchIntent = activity.getIntent();
    if (launchIntent.hasExtra("forceReload")) {
        // When Activity is launched due to forceReload, minimize the app.
        activity.moveTaskToBack(true);
    }
}

From source file:com.marianhello.cordova.bgloc.LocationUpdateService.java

@Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "OnCreate");

        locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
        alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
        toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
        connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
        telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

        // Stop-detection PI
        stationaryAlarmPI = PendingIntent.getBroadcast(this, 0, new Intent(STATIONARY_ALARM_ACTION), 0);
        registerReceiver(stationaryAlarmReceiver, new IntentFilter(STATIONARY_ALARM_ACTION));

        // Stationary region PI
        stationaryRegionPI = PendingIntent.getBroadcast(this, 0, new Intent(STATIONARY_REGION_ACTION),
                PendingIntent.FLAG_CANCEL_CURRENT);
        registerReceiver(stationaryRegionReceiver, new IntentFilter(STATIONARY_REGION_ACTION));

        // Stationary location monitor PI
        stationaryLocationPollingPI = PendingIntent.getBroadcast(this, 0,
                new Intent(STATIONARY_LOCATION_MONITOR_ACTION), 0);
        registerReceiver(stationaryLocationMonitorReceiver, new IntentFilter(STATIONARY_LOCATION_MONITOR_ACTION));

        // One-shot PI (TODO currently unused)
        singleUpdatePI = PendingIntent.getBroadcast(this, 0, new Intent(SINGLE_LOCATION_UPDATE_ACTION),
                PendingIntent.FLAG_CANCEL_CURRENT);
        registerReceiver(singleUpdateReceiver, new IntentFilter(SINGLE_LOCATION_UPDATE_ACTION));

        /////*from w w w . j  a v a2s  . c o  m*/
        // DISABLED
        // Listen to Cell-tower switches (NOTE does not operate while suspended)
        //telephonyManager.listen(phoneStateListener, LISTEN_CELL_LOCATION);
        //

        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);

        wakeLock.acquire();

        // Location criteria
        criteria = new Criteria();
        criteria.setAltitudeRequired(false);
        criteria.setBearingRequired(false);
        criteria.setSpeedRequired(true);
        criteria.setCostAllowed(true);
    }

From source file:com.grupohqh.carservices.operator.ReadTagActivity.java

private void readTag() {
    runOnUiThread(new Runnable() {
        int scantimes = 25;
        String tagId;//  w ww . j a v  a  2  s .  c o  m
        ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);

        @Override
        public void run() {
            for (int i = 0; i < scantimes; i++) {
                MtiCmd mtiCmd = new CMD_Iso18k6cTagAccess.RFID_18K6CTagInventory(usbCommunication);
                CMD_Iso18k6cTagAccess.RFID_18K6CTagInventory finalCmd = (CMD_Iso18k6cTagAccess.RFID_18K6CTagInventory) mtiCmd;
                if (finalCmd.setCmd(CMD_Iso18k6cTagAccess.Action.StartInventory)) {
                    tagId = finalCmd.getTagId();
                    if (finalCmd.getTagNumber() > 0) {
                        tg.startTone(ToneGenerator.TONE_PROP_BEEP);
                        etEpc.setText(tagId);
                        break;
                    }
                }
            }
            if (!etEpc.getText().toString().equals(""))
                new HttpAsyncTask().execute(URL);
            else
                etEpc.setHint("No se encontro ningun TAG");
        }
    });
}

From source file:net.inbox.Pager.java

private void activity_load() {
    // Init notification sound
    beep = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 1000);

    // Init vibrations
    vvv = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

    Toolbar tb = (Toolbar) findViewById(R.id.home_toolbar);
    setSupportActionBar(tb);/*from   www .j  a  v a 2 s  .c  o m*/

    tf = Typeface.createFromAsset(getAssets(), "fonts/Dottz.ttf");

    // Find the title
    TextView tv_t;
    for (int i = 0; i < tb.getChildCount(); ++i) {
        int idd = tb.getChildAt(i).getId();
        if (idd == -1) {
            tv_t = (TextView) tb.getChildAt(i);
            tv_t.setTextColor(ContextCompat.getColor(this, R.color.color_title));
            tv_t.setTypeface(tf);
            break;
        }
    }

    if (getSupportActionBar() != null) {
        getSupportActionBar().setTitle(getString(R.string.activity_pager_title).toUpperCase());
    }

    // Unread Messages Counter
    tv_page_counter = (TextView) findViewById(R.id.page_counter);
    tv_page_counter.setTypeface(tf);

    // Mass Refresh Button
    ImageButton iv_refresh = (ImageButton) findViewById(R.id.refresh);
    iv_refresh.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mass_refresh_check();
        }
    });

    // No accounts message is visible if the user has not init-ed the app
    tv_no_account = (TextView) findViewById(R.id.no_accounts);
    tv_no_account.setTypeface(tf);

    // Filling the ListView of the home window
    inbox_list_view = (ListView) findViewById(R.id.accounts_list_view);
    populate_list_view();
}

From source file:uk.org.openseizuredetector.client.SdClientService.java

/**
 * beep for duration miliseconds./* w  w w  . ja v  a2  s  .c o m*/
 */
private void beep(int duration) {
    ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
    toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, duration);
    Log.v(TAG, "beep()");
}