title: Notification not vibrating or showing the light
body: <p>I'm using Visual Studio 2019 16.6.0 Preview 2.1 and I'm trying to get vibrate and the light to work on the Galaxy S10 (Android 10) I'm testing my app on.  I get the notification, but the phone doesn't vibrate and the light doesn't come on.  I'd also like to have a sound as well, but nothing I've tried on here complies in Visual Studio as all examples/samples I can find are in java.  My code complies and runs without error.</p>
  
  <pre><code>        if (Android.OS.Build.VERSION.SdkInt &gt;= BuildVersionCodes.O)
          {
              string NOTIFICATION_CHANNEL_ID = "com.OML.Android";
              string channelName = "Notifications Service";
              NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, Android.App.NotificationImportance.None);
              chan.EnableLights(true);
              chan.EnableVibration(true);
              chan.LightColor = Color.Red;
              //chan.SetSound() &lt;&lt;-- simply can't figure out how to construct a Uri to the default sound
              chan.LockscreenVisibility = Android.App.NotificationVisibility.Private;
              NotificationManager manager = (NotificationManager)GetSystemService(Context.NotificationService);
              manager.CreateNotificationChannel(chan);
              NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
              Notification notification = notificationBuilder.SetOngoing(true)
                      .SetSmallIcon(Resource.Drawable.alert_box)
                      .SetContentTitle("Alert System")
                      .SetPriority(1)
                      .SetAutoCancel(true)
                      .Build();
              StartForeground(2, notification);
          } else
          {
              Notification notify = new Notification();
              notify.Defaults = NotificationDefaults.All;
              StartForeground(Constants.SERVICE_RUNNING_NOTIFICATION_ID, notify);
          }
  </code></pre>
  
  <p>So what am I missing?</p>
  
  <p><strong>* UPDATE *</strong></p>
  
  <p>Per @Cherry Bu - MSFT's answer I changed my code to:</p>
  
  <pre><code>        if (Android.OS.Build.VERSION.SdkInt &gt;= BuildVersionCodes.O)
          {
              string NOTIFICATION_CHANNEL_ID = "com.OML.Android";
              string channelName = "Notifications Service";
              NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, Android.App.NotificationImportance.None);
              chan.EnableLights(true);
              chan.EnableVibration(true);
              chan.LightColor = Color.Red;
              chan.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification), new AudioAttributes.Builder().SetUsage(AudioUsageKind.Notification).Build());
              chan.LockscreenVisibility = Android.App.NotificationVisibility.Private;
              NotificationManager manager = (NotificationManager)GetSystemService(Context.NotificationService);
              manager.CreateNotificationChannel(chan);
              NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
              Notification notification = notificationBuilder.SetOngoing(true)
                      .SetSmallIcon(Resource.Drawable.alert_box)
                      .SetContentTitle("Alert System")
                      .SetPriority(1)
                      //.SetVibrate(new long[] { 1000, 1000 })
                      //,SetLights(Color.AliceBlue, 3000, 3000)
                      .SetAutoCancel(true)
                      .Build();
              StartForeground(2, notification);
          } else
          {
              Notification notify = new Notification();
              notify.Defaults = NotificationDefaults.All;
              StartForeground(Constants.SERVICE_RUNNING_NOTIFICATION_ID, notify);
          }
          SingletonServicemanager.isMyServiceRunning = true;
          return StartCommandResult.Sticky;
      }
  </code></pre>
  
  <p>I also added the following permissions to the manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  </code></pre>
  
  <p><strong>* Update *</strong></p>
  
  <p>Took a look at the github project @Cherry Bu - MSFT posted and I believe I'm doing exactly the same as he is but my code doesn't work, so in the interest of solving this I am posting the code for my foreground service.  First, the code I use to start the service which is part of my <code>Utils</code> code:</p>
  
  <pre><code>    public static void StartForegroundServiceComapt&lt;SignalRSrv&gt;(Context context, Bundle args = null) where SignalRSrv : Service
      {
          var intent = new Intent(context, typeof(SignalRSrv));
  
          if (args != null)
          {
              intent.PutExtra("TheBundle", args);
          }
  
          if (Android.OS.Build.VERSION.SdkInt &gt;= Android.OS.BuildVersionCodes.O)
          {
              context.StartForegroundService(intent);
          }
          else
          {
              context.StartService(intent);
          }
      }
  </code></pre>
  
  <p>As you can see from the code above, I'm starting a SignalR service, that code is:</p>
  
  <pre><code>public class SignalRSrv : Service
  {
      private bool InstanceFieldsInitialized = false;
      private string username = "";
      private string firstname = "";
      private string lastname = "";
      private string company = "";
      private string department = "";
      private string section = "";
      private int notifyid = 0;
      public SignalRSingleton mInstance;
  
      private void InitializeInstanceFields()
      {
          mBinder = new LocalBinder(this);
      }
  
      private Handler mHandler; // to display any received messages
      private IBinder mBinder; // Binder given to clients
      private Notification notification = null;
  
      public SignalRSrv()
      {
          if (!InstanceFieldsInitialized)
          {
              InitializeInstanceFields();
              InstanceFieldsInitialized = true;
          }
  
      }
  
      public SignalRSingleton GetInstance()
      {
          return mInstance;
      }
      public override void OnCreate()
      {
          base.OnCreate();
          mInstance = SignalRSingleton.getInstance();
          mHandler = new Handler(Looper.MainLooper);
      }
  
      public override void OnDestroy()
      {
         try
          {
              if (Build.VERSION.SdkInt &gt;= BuildVersionCodes.N)
              {
                  StopForeground(StopForegroundFlags.Remove);
              }
              else
              {
                  StopForeground(true);
              }
  
              StopSelf();
          }
          catch (System.Exception e)
          {
              var m = e.Message;
          }
      }
  
  
      public override IBinder OnBind(Intent intent)
      {
          return null;
      }
  
      private void startSignalR(Bundle bundle)
      {
  
          User MyUser = bundle.GetParcelable("MyUser") as User;
          if (MyUser.Department == null || MyUser.Department == "")
          {
              MyUser.Department = "none";
          }
          if (MyUser.Section == null || MyUser.Section == "")
          {
              MyUser.Section = "none";
          }
          mInstance.setmHubConnection(MyUser.Username, MyUser.Firstname ,MyUser.Lastname,MyUser.Company ,MyUser.Department,MyUser.Section, "FOREGROUND");
          mInstance.setHubProxy();
  
          try
          {
              // Connect the client to the hup
              mInstance.mHubConnection.Start().Wait(-1);
  
              mInstance.mHubProxy.On("broadcastMessage", (string platform, string message) =&gt;
              {
                  try
                  {
                      if (!isApplicationInTheBackground())
                      {
                          showMessage(message);
                      } else
                      {
                          showNotification(message, bundle, notification);
                      }
  
                  }
                  catch (System.Exception e)
                  {
                     var error = e.Message;
                  }
              });
          }
          catch (System.Exception e) when (e is InterruptedException || e is ExecutionException)
          {
              //opps
  
              //var x = 1;
              return;
          }
      }
  
      public async void showMessage(string message)
      {
  
  
          try
          {
  
              var result = await UserDialogs.Instance.ConfirmAsync(new ConfirmConfig
              {
                  Message = "Alert - " + message,
                  OkText = "Ok",
  
              });
              if (result)
              {
                  // do something
                  var x = message;
              }
          }
          catch (System.Exception e)
          {
              var s = e.Message;
          }
      }
      public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
      {
  
          User MyUser = new User("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
          Bundle bundlee = intent.GetBundleExtra("TheBundle");
          MyUser = bundlee.GetParcelable("MyUser") as User;
  
          username = MyUser.Username;
          firstname = MyUser.Firstname;
          lastname = MyUser.Lastname;
          company = intent.GetStringExtra("theSelectedCompany");
          department = intent.GetStringExtra("theSelectedDepartment");
          section = intent.GetStringExtra("theSelectedSection");
  
          startSignalR(bundlee);
  
          if (Android.OS.Build.VERSION.SdkInt &gt;= BuildVersionCodes.O)
          {
              string NOTIFICATION_CHANNEL_ID = "com.OML.Android";
              string channelName = "Notifications Service";
              NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, Android.App.NotificationImportance.None);
              chan.EnableLights(true);
              chan.EnableVibration(true);
              chan.LightColor = Color.Red;
              chan.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification), new AudioAttributes.Builder().SetUsage(AudioUsageKind.Notification).Build());
              chan.LockscreenVisibility = Android.App.NotificationVisibility.Private;
              NotificationManager manager = (NotificationManager)GetSystemService(Context.NotificationService);
              manager.CreateNotificationChannel(chan);
              NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
              Notification notification = notificationBuilder.SetOngoing(true)
                      .SetSmallIcon(Resource.Drawable.alert_box)
                      .SetContentTitle("Alert System")
                      .SetPriority(1)
                      //.SetVibrate(new long[] { 1000, 1000 })
                      //,SetLights(Color.AliceBlue, 3000, 3000)
                      .SetAutoCancel(true)
                      .Build();
              StartForeground(Constants.SERVICE_RUNNING_NOTIFICATION_ID, notification);
          } else
          {
              Notification notify = new Notification();
              notify.Defaults = NotificationDefaults.All;
              StartForeground(Constants.SERVICE_RUNNING_NOTIFICATION_ID, notify);
          }
          SingletonServicemanager.isMyServiceRunning = true;
          return StartCommandResult.Sticky;
      }
  
      private void cancelnotification()
      {
          NotificationManager notificationManager = (NotificationManager)Android.App.Application.Context.GetSystemService(Context.NotificationService);
          notificationManager.Cancel(notifyid);
  
      }
  
      public void showNotification( string message, Bundle bundle, Notification notification)
      {
          try
          {
              Intent intent = new Intent();
              User MyUser = new User("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
              MyUser = bundle.GetParcelable("MyUser") as User;
              if (MyUser.Usertype != "")
              {
                  if (MyUser.Usertype == "COMPADMIN")
                  {
                      intent = new Intent(this, typeof(Drawer)); //Activity you want to open
                  } else if (MyUser.Usertype == "DEPTADMIN") {
                      intent = new Intent(this, typeof(Drawer)); //Activity you want to open
                  } else
                  {
                      intent = new Intent(this, typeof(regUser)); //Activity you want to open
                  }
              }
              else
              {
                  intent = new Intent(this, typeof(regUser)); //Activity you want to open
              }
              intent.AddFlags(ActivityFlags.ClearTop);
              intent.PutExtra("TheBundle", bundle);
              intent.PutExtra("MessageReceived", message);
  
              var pendingIntent = PendingIntent.GetActivity(this, RandomGenerator(), intent, PendingIntentFlags.OneShot);
  
              NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,"com.OML.Android")
                   .SetSmallIcon(Resource.Drawable.alert_box)
                   .SetContentTitle("Message Received")
                   .SetContentText(message)
                   .SetAutoCancel(true)
                   .SetContentIntent(pendingIntent);
  
              NotificationManager notificationManager = (NotificationManager)Android.App.Application.Context.GetSystemService(Context.NotificationService);
              notifyid = RandomGenerator();
              notificationManager.Notify(notifyid, notificationBuilder.Build());
  
          }
          catch (System.Exception e)
          {
              Utils.LogError("An error occured in SignalRSrv.cs ShowNotification, the error is: " + e.Message);
          }
      }
      private int RandomGenerator()
      {
          return new Random().Next(int.MinValue, int.MaxValue);
      }
      private bool isApplicationInTheBackground()
      {
          bool isInBackground;
  
          RunningAppProcessInfo myProcess = new RunningAppProcessInfo();
          ActivityManager.GetMyMemoryState(myProcess);
          isInBackground = myProcess.Importance != Android.App.Importance.Foreground;
  
          return isInBackground;
      }
  }
  
  public class LocalBinder : Binder
  {
      private readonly SignalRSrv outerInstance;
  
      public LocalBinder(SignalRSrv outerInstance)
      {
          this.outerInstance = outerInstance;
      }
  
      public virtual SignalRSrv Service
      {
          get
          {
              // Return this instance of SignalRSrv so clients can call public methods
              return outerInstance;
          }
      }
  }
  </code></pre>
  
  <p>It is within the SignalRSrv code where I create the channel, is that wrong?</p>