Forum Xamarin Xamarin.Android

Ringtone Manager not playing ringtone while in Silent Mode

ClementPOIRETClementPOIRET USMember
edited July 2017 in Xamarin.Android

Good Evening !

I'm trying to make an AlarmManager that will play a Ringtone in loop but unfortunately it's not playing any song when the phone is in silent mode. How can I do that ? Here is my actual code in my Broadcast Receiver:

    public class OneShotAlarm : BroadcastReceiver
        //sleep_main slpmain;
        Intent serviceToStart;
        public override void OnReceive(Context context, Intent intent)
            Toast.MakeText(context, "Received", ToastLength.Short).Show();
            Android.Net.Uri notification = RingtoneManager.GetDefaultUri(RingtoneType.Alarm);
            Ringtone r = RingtoneManager.GetRingtone(Application.Context, notification);

            serviceToStop = new Intent(context, typeof(TimestampService));

PS : Should I use a Media Player to make it loop ?

Thanks a lot for your help,

Sign In or Register to comment.