use of android.media.Ringtone in project HoloEverywhere by Prototik.
the class _RingtonePickerDialog method run.
@Override
public void run() {
if (sampleRingtonePos == silentPos) {
ringtoneManager.stopPreviousRingtone();
return;
}
if (defaultRingtone != null && defaultRingtone.isPlaying()) {
defaultRingtone.stop();
defaultRingtone = null;
}
Ringtone ringtone;
if (sampleRingtonePos == defaultRingtonePos) {
if (defaultRingtone == null) {
defaultRingtone = RingtoneManager.getRingtone(context, uriForDefaultItem);
}
ringtone = defaultRingtone;
ringtoneManager.stopPreviousRingtone();
} else {
ringtone = ringtoneManager.getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
}
if (ringtone != null) {
ringtone.play();
}
}
use of android.media.Ringtone in project android_frameworks_base by crdroidandroid.
the class Notifier method playWirelessChargingStartedSound.
private void playWirelessChargingStartedSound() {
final boolean enabled = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.CHARGING_SOUNDS_ENABLED, 1) != 0;
final String soundPath = Settings.Global.getString(mContext.getContentResolver(), Settings.Global.WIRELESS_CHARGING_STARTED_SOUND);
if (enabled && soundPath != null) {
final Uri soundUri = Uri.parse("file://" + soundPath);
if (soundUri != null) {
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
if (sfx != null) {
sfx.setStreamType(AudioManager.STREAM_SYSTEM);
sfx.play();
}
}
}
mSuspendBlocker.release();
}
Aggregations