Start Sound on BroadCast Receiving in Xamarin Android C#

MarwatMarwat PKMember ✭✭

MainActivity.cs

private void StartAlarm() { Intent myIntent; PendingIntent pendingIntent; myIntent = new Intent(this, typeof(AlarmToastReceiver)); pendingIntent = PendingIntent.GetBroadcast(this, 0, myIntent, 0); alarm_manager.Set(AlarmType.RtcWakeup, calndr.TimeInMillis, pendingIntent); }

AlarmToastReceiver.cs

[BroadcastReceiver(Enabled =true)] public class AlarmToastReceiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { Toast.MakeText(context, "THIS IS MY ALARM", ToastLength.Long).Show(); } }

I am going to create an Alaram App in Xamarin. So here i pick the Time from TimePicker, and then and set the Alaram Manager Instance. When the Pending Intent completed , then BroadCastReceiver is active, and a Message is Shown to me,i.e "THIS IS MY ALARM", but here i want to Start Some Kind of Sound, i.e Animal Sound,Bird Sound etc.So how i can do it,can any one help me?thanks in advance.

Sign In or Register to comment.