do not attempt to play 'none' ringtone
trying to play 'none' ringtone resulted in the default ring tone being played
This commit is contained in:
parent
ebb38d7d75
commit
53da64b7e2
|
@ -34,6 +34,8 @@ import androidx.core.app.RemoteInput;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -397,20 +399,25 @@ public class NotificationService {
|
|||
|
||||
public void startRinging(final AbstractJingleConnection.Id id, final Set<Media> media) {
|
||||
showIncomingCallNotification(id, media);
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mXmppConnectionService);
|
||||
final Resources resources = mXmppConnectionService.getResources();
|
||||
final Uri uri = Uri.parse(preferences.getString("call_ringtone", resources.getString(R.string.incoming_call_ringtone)));
|
||||
this.currentlyPlayingRingtone = RingtoneManager.getRingtone(mXmppConnectionService, uri);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
this.currentlyPlayingRingtone.setLooping(true);
|
||||
}
|
||||
this.currentlyPlayingRingtone.play();
|
||||
this.vibrationFuture = SCHEDULED_EXECUTOR_SERVICE.scheduleAtFixedRate(
|
||||
new VibrationRunnable(),
|
||||
0,
|
||||
3,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mXmppConnectionService);
|
||||
final Resources resources = mXmppConnectionService.getResources();
|
||||
final String ringtonePreference = preferences.getString("call_ringtone", resources.getString(R.string.incoming_call_ringtone));
|
||||
if (Strings.isNullOrEmpty(ringtonePreference)) {
|
||||
Log.d(Config.LOGTAG,"ringtone has been set to none");
|
||||
return;
|
||||
}
|
||||
final Uri uri = Uri.parse(ringtonePreference);
|
||||
this.currentlyPlayingRingtone = RingtoneManager.getRingtone(mXmppConnectionService, uri);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
this.currentlyPlayingRingtone.setLooping(true);
|
||||
}
|
||||
this.currentlyPlayingRingtone.play();
|
||||
}
|
||||
|
||||
private void showIncomingCallNotification(final AbstractJingleConnection.Id id, final Set<Media> media) {
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
<string name="pref_ringtone">Ringtone</string>
|
||||
<string name="pref_notification_sound">Notification sound</string>
|
||||
<string name="pref_notification_sound_summary">Notification sound for new messages</string>
|
||||
<string name="pref_call_ringtone_summary">Ringtone for incoming call</string>
|
||||
<string name="pref_call_ringtone_summary">Ringtone for incoming calls</string>
|
||||
<string name="pref_notification_grace_period">Grace Period</string>
|
||||
<string name="pref_notification_grace_period_summary">The length of time notifications are silenced after detecting activity on one of your other devices.</string>
|
||||
<string name="pref_advanced_options">Advanced</string>
|
||||
|
|
Loading…
Reference in a new issue