コード例 #1
0
ファイル: DataSender.cs プロジェクト: VvBooMvV/Projects
	public void BeginMessage(RemoteMessage message)
	{
		SDebug.Assert(message == RemoteMessage.Invalid);

		this.message = message;
		packet.Position = 0;
		packet.SetLength(0);
	}
コード例 #2
0
ファイル: DataSender.cs プロジェクト: VvBooMvV/Projects
	public void EndMessage(Stream stream)
	{
		SDebug.Assert(message != RemoteMessage.Invalid);

		// Write message header
		stream.WriteByte((byte)message);
		uint len = (uint)packet.Length;
		stream.WriteByte((byte)(len & 0xFF));
		stream.WriteByte((byte)((len >> 8) & 0xFF));
		stream.WriteByte((byte)((len >> 16) & 0xFF));
		stream.WriteByte((byte)((len >> 24) & 0xFF));

		// Write the message
		packet.Position = 0;
		Utils.CopyToStream(packet, stream, buffer, (int)packet.Length);

		message = RemoteMessage.Invalid;
	}
コード例 #3
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     Log.Debug(TAG, "From: " + message.From);
     Log.Debug(TAG, "Notification Message Body: " + message.GetNotification().Body);
     SendNotification(message.GetNotification().Body);
 }
コード例 #4
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     base.OnMessageReceived(message);
     ShowNotification(message);
 }
コード例 #5
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     base.OnMessageReceived(message);
     new NotificationHelper().CreateNotification(message.GetNotification().Title, message.GetNotification().Body);
 }
コード例 #6
0
ファイル: ShinyFirebaseService.cs プロジェクト: moljac/shiny
 public override void OnMessageReceived(RemoteMessage message)
     => MessageReceived?.Invoke(message);
コード例 #7
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     Debug.WriteLine(TAG, "From: " + message.From);
     Debug.WriteLine(TAG, "Notification Message Body: " + message.GetNotification().Body);
     SendNotification(message.GetNotification().Body, message.Data);
 }
コード例 #8
0
        public virtual void OnReceivedRemoteNotification(RemoteMessage message)
        {
            PushNotificationData notification = AppKitFirebaseMessagingService.GetNotificationData(message);

            OnReceivedRemoteNotification(notification);
        }
コード例 #9
0
 public override void OnMessageReceived(RemoteMessage remoteMessage)
 {
     base.OnMessageReceived(remoteMessage);
 }
コード例 #10
0
 public void onMessageReceived(RemoteMessage remoteMessage)
 {
 }
コード例 #11
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     base.OnMessageReceived(message);
     CrossFirebaseCloudMessaging.Current.OnNotificationReceived(message.ToFCMNotification());
 }
コード例 #12
0
 //receives notification when app is in foreground
 public override void OnMessageReceived(RemoteMessage message)
 {
     Log.Debug(TAG, "--------Service called-------");
     HandleNotification(message);
 }
コード例 #13
0
        /// <summary>
        /// Processes a message from the webserver, and redirects to the appropriate method.
        /// </summary>
        /// <param name="remoteMessage"></param>
        /// <returns></returns>
        private async Task ProcessMessage(RemoteMessage remoteMessage)
        {
            var cancellationTokenSource = new CancellationTokenSource();
            var commandCancel           = cancellationTokenSource.Token;

            try
            {
                // var remoteMessage = Json.DeserializeObject<RemoteMessage>(message, TemporaryEncryptionKey);

                //if the success is false, then it is a dummy message returned through a long polling timeout, so just ignore.
                if (!remoteMessage.Success)
                {
                    return;
                }

                _logger.LogDebug($"Message received is command: {remoteMessage.Method}, messageId: {remoteMessage.MessageId}.");

                //JObject values = (JObject)command.Value;
                // if (!string.IsNullOrEmpty((string)command.Value))
                //     values = JObject.Parse((string)command.Value);

                var method = typeof(RemoteOperations).GetMethod(remoteMessage.Method);

                if (method == null)
                {
                    _logger.LogError(100, "Unknown method : " + remoteMessage.Method);
                    var error = new ReturnValue <object>(false, $"Unknown method: {remoteMessage.Method}.", null);
                    AddResponseMessage(remoteMessage.MessageId, error);
                    return;
                }

                if (remoteMessage.SecurityToken == _sharedSettings.SecurityToken)
                {
                    Stream stream;

                    // if method is a task, execute async
                    if (method.ReturnType == typeof(Task))
                    {
                        var task = (Task)method.Invoke(_remoteOperations, new object[] { remoteMessage, commandCancel });
                        if (task.IsFaulted)
                        {
                            throw task.Exception;
                        }
                        await task.ConfigureAwait(false);

                        return;

                        // if method is a void, execute sync
                    }
                    else if (method.ReturnType == typeof(void))
                    {
                        method.Invoke(_remoteOperations, new object[] { remoteMessage, commandCancel });
                        return;
                    }

                    // if method is a task with a return type, create a call back stream to execute
                    else if (method.ReturnType.BaseType == typeof(Task))
                    {
                        var args = method.ReturnType.GetGenericArguments();
                        if (args.Length > 0 && args[0].IsAssignableFrom(typeof(Stream)))
                        {
                            var task = (Task)method.Invoke(_remoteOperations, new object[] { remoteMessage, commandCancel });
                            if (task.IsFaulted)
                            {
                                throw task.Exception;
                            }
                            await task.ConfigureAwait(false);

                            var resultProperty = task.GetType().GetProperty("Result");
                            stream = (Stream)resultProperty.GetValue(task);
                        }
                        else
                        {
                            stream = new StreamAsyncAction <object>(async() =>
                            {
                                var task = (Task)method.Invoke(_remoteOperations, new object[] { remoteMessage, commandCancel });
                                if (task.IsFaulted)
                                {
                                    throw task.Exception;
                                }
                                await task.ConfigureAwait(false);
                                var property = task.GetType().GetProperty("Result");

                                if (property == null)
                                {
                                    throw new RemoteOperationException($"The method {method.Name} does not return a result.");
                                }

                                return(property.GetValue(task));
                            });
                        }

                        // if method is a stream, then start the stream.
                    }
                    else if (method.ReturnType.IsAssignableFrom(typeof(Stream)))
                    {
                        try
                        {
                            stream = (Stream)method.Invoke(_remoteOperations,
                                                           new object[] { remoteMessage, commandCancel });
                        }
                        catch (TargetInvocationException ex)
                        {
                            throw ex.InnerException ?? ex;
                        }
                    }

                    // other return types, execute sync.
                    else
                    {
                        try
                        {
                            stream = new StreamAction <object>(() =>
                                                               method.Invoke(_remoteOperations, new object[] { remoteMessage, commandCancel }));
                        }
                        catch (TargetInvocationException ex)
                        {
                            throw ex.InnerException ?? ex;
                        }
                    }

                    await _sharedSettings.StartDataStream(remoteMessage.MessageId, stream, remoteMessage.DownloadUrl, "json", "", false, commandCancel);
                }
                else
                {
                    throw new RemoteException($"The command {remoteMessage.Method} failed due to mismatching security tokens.");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(100, ex, "Unknown error processing incoming message: " + ex.Message);
                var error = new ReturnValue <object>(false, $"{ex.Message}", ex);

                // when error occurs, set local cache or send to proxy so message gets to client.
                if (remoteMessage.DownloadUrl.DownloadUrlType != EDownloadUrlType.Proxy)
                {
                    var stream = new StreamAction <ReturnValue>(() => error);
                    await _sharedSettings.StartDataStream(remoteMessage.MessageId, stream, remoteMessage.DownloadUrl, "json", "", true, commandCancel);

//
//                    _memoryCache.Set(remoteMessage.MessageId, stream, TimeSpan.FromSeconds(5));
                }
                else
                {
                    var result = new ReturnValue(false, ex.Message, ex);
                    await _sharedSettings.PostDirect($"{remoteMessage.DownloadUrl.Url}/error/{remoteMessage.MessageId}", result.Serialize(), commandCancel);
                }
            }
        }
コード例 #14
0
 public MessageNotification(RemoteMessage remoteMessage)
 {
     Title = remoteMessage.Data.TryGetValue("title", out var title) ? title : "Private Messenger: New Message";
     Body  = remoteMessage.Data.TryGetValue("body", out var body) ? body : "";
 }
コード例 #15
0
#pragma warning disable CS0809 // El miembro obsoleto invalida un miembro no obsoleto
        public override void OnMessageReceived(RemoteMessage message)
#pragma warning restore CS0809 // El miembro obsoleto invalida un miembro no obsoleto
        {
            base.OnMessageReceived(message);
            SendNotification(message.GetNotification());
        }
コード例 #16
0
 public virtual void onMessageReceived(RemoteMessage arg0)
 {
 }
コード例 #17
0
        public override void OnMessageReceived(RemoteMessage message)
        {
            var body = message.GetNotification().Body;

            SendNotification(body, message.Data);
        }
コード例 #18
0
        public void DidReceiveMessage(Messaging messaging, RemoteMessage message)
        {
            try
            {//var data = remoteMessage.AppData;
                string title            = message.AppData.ObjectForKey(new NSString("title")).ToString();
                string text             = message.AppData.ObjectForKey(new NSString("text")).ToString();
                var    notificationType = message.AppData.ObjectForKey(new NSString("notificationType")).ToString();
                if (notificationType.Contains("NEWS"))
                {
                    //Handle News Notification
                    int notiId = new Random().Next(0, 1000000);

                    string newTitle = title;
                    string newsJson = message.AppData.ObjectForKey(new NSString("news")).ToString(); //"123";//noti_id.ObjectForKey(new NSString("newsId")).ToString();

                    NotificationNewsPayLoad notificationNewsPayLoad = JsonConvert.DeserializeObject <NotificationNewsPayLoad>(newsJson);

                    string newsId = notificationNewsPayLoad.newsId.ToString();

                    //string removeTitle = title.Substring(title.IndexOf("|-|NEWS"));
                    //string newTitle = title.Replace(removeTitle, "");
                    //string newsId = removeTitle.Split(';')[1];

                    SJMC.Helpers.Settings.NewsNotificationOpen = true;

                    var data = SJMC.Helpers.Settings.NewsNotificationList;

                    data.Add(new Models.NotificationNewsOpenerModel
                    {
                        NewsId         = newsId,
                        NewsTitle      = newTitle,
                        NewsText       = text,
                        IsRead         = false,
                        NotificationId = notiId
                    });
                    SJMC.Helpers.Settings.OpenNewsNumber       = notiId;
                    SJMC.Helpers.Settings.NewsNotificationList = data;

                    //hamad
                    //SJMC.Helpers.Settings.NotificationBadageCount += 1;
                    //CrossBadge.Current.SetBadge(SJMC.Helpers.Settings.NotificationBadageCount);

                    SJMC.Helpers.Settings.NotificationKind = "SjmcNewsNotification";
                    SendNotification(text, newTitle, message.AppData, notiId, "SjmcNewsNotification");
                }
                else
                {
                    if (SJMC.Helpers.Settings.Email == "")
                    {
                        return;
                    }

                    string reportJson = message.AppData.ObjectForKey(new NSString("report")).ToString(); //"123";//noti_id.ObjectForKey(new NSString("newsId")).ToString();

                    NotificationReportPayLoad notificationReportPayLoad = JsonConvert.DeserializeObject <NotificationReportPayLoad>(reportJson);

                    // Handle the Report Notification
                    //string description = text.Substring(0, text.IndexOf("|-|"));
                    //int startIndex = text.IndexOf("|-|") + 3;
                    //string parameter = text.Substring(startIndex, (text.Length - startIndex) - 1);
                    //string[] parameters = parameter.Split(";");

                    int notiId = new Random().Next(0, 1000000);

                    //SJMC.Helpers.Settings.NotificationList = new List<Models.NotificationReportOpenerModel>();
                    var data = SJMC.Helpers.Settings.NotificationList;

                    NotificationReportOpenerModel notificationReportOpenerModel = new NotificationReportOpenerModel()
                    {
                        ReportType     = notificationReportPayLoad.ReportType, //parameters[0],
                        AsBrch         = notificationReportPayLoad.AsBrch,     //parameters[1],
                        AsYear         = notificationReportPayLoad.AsYear,     //parameters[2],
                        AsRef          = notificationReportPayLoad.AsRef,      //parameters[3],
                        IsRead         = false,
                        NotificationId = notiId
                    };

                    data.Add(new Models.NotificationReportOpenerModel
                    {
                        ReportType     = notificationReportPayLoad.ReportType, //parameters[0],
                        AsBrch         = notificationReportPayLoad.AsBrch,     //parameters[1],
                        AsYear         = notificationReportPayLoad.AsYear,     //parameters[2],
                        AsRef          = notificationReportPayLoad.AsRef,      //parameters[3],
                        IsRead         = false,
                        NotificationId = notiId
                    });

                    /*data.Add(new Models.NotificationReportOpenerModel
                     * {
                     *  ReportType = parameters[0],
                     *  AsBrch = parameters[1],
                     *  AsYear = parameters[2],
                     *  AsRef = parameters[3],
                     *  IsRead = false,
                     *  NotificationId = notiId
                     * });*/

                    SJMC.Helpers.Settings.NotificationList = data;
                    SJMC.Helpers.Settings.OpenReportNumber = notiId;
                    //Set Notification Badage on App
                    //hamad
                    //SJMC.Helpers.Settings.NotificationBadageCount += 1;
                    //CrossBadge.Current.SetBadge(SJMC.Helpers.Settings.NotificationBadageCount);
                    SJMC.Helpers.Settings.NotificationKind = "SjmcReportNotification";
                    //var body = message.GetNotification().Body;
                    SendNotification(text, title, message.AppData, notiId, "SjmcReportNotification");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("AppDelegate DidReceiveMessage Exception " + ex.Message);
            }
        }
コード例 #19
0
 public void DidReceiveMessage(Messaging messaging, RemoteMessage remoteMessage)
 {
     LogInformation(nameof(DidReceiveMessage), remoteMessage.AppData);
 }
コード例 #20
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     base.OnMessageReceived(message);
     new AndroidNotificationManager().ReceiveNotification(message.GetNotification().Title, message.GetNotification().Body);
 }
コード例 #21
0
        public override void OnMessageReceived(RemoteMessage message)
        {
            var notification = message.GetNotification();

            SendNotification(notification.Title, notification.Body, message.Data);
        }
コード例 #22
0
        public void SendNotifications(RemoteMessage message)
        {
            try
            {
                NotificationManager manager = (NotificationManager)GetSystemService(NotificationService);
                var seed = Convert.ToInt32(Regex.Match(Guid.NewGuid().ToString(), @"\d+").Value);
                int id   = new Random(seed).Next(000000000, 999999999);
                var push = new Intent();
                push.AddFlags(ActivityFlags.ClearTop);
                var fullScreenPendingIntent = PendingIntent.GetActivity(this, MainActivity.NOTIFICATION_ID,
                                                                        push, PendingIntentFlags.UpdateCurrent);
                NotificationCompat.Builder notification;
                if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                {
                    var chan1 = new NotificationChannel(PRIMARY_CHANNEL,
                                                        new Java.Lang.String("Primary"), NotificationImportance.High);
                    chan1.LightColor           = Color.Green;
                    chan1.LockscreenVisibility = NotificationVisibility.Public;
                    chan1.SetShowBadge(true);
                    manager.CreateNotificationChannel(chan1);
                    notification = new NotificationCompat.Builder(this, MainActivity.CHANNEL_ID);
                    notification.SetFullScreenIntent(fullScreenPendingIntent, true);
                }
                else
                {
                    notification = new NotificationCompat.Builder(this);
                }

                // set the vibration patterns for the channels
                long[] urgentVibrationPattern = { 100, 30, 100, 30, 100, 200, 200, 30, 200, 30, 200, 200, 100, 30, 100, 30, 100, 100, 30, 100, 30, 100, 200, 200, 30, 200, 30, 200, 200, 100, 30, 100, 30, 100 };

                // Creating an Audio Attribute
                var alarmAttributes = new AudioAttributes.Builder()
                                      .SetContentType(AudioContentType.Speech)
                                      .SetUsage(AudioUsageKind.Notification).Build();

                // Create the uri for the alarm file

                var             recordingFileDestinationPath = System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, AppConstants.NotificationSound);
                Android.Net.Uri urgentAlarmUri = Android.Net.Uri.Parse(recordingFileDestinationPath);

                notification.SetContentIntent(fullScreenPendingIntent)
                .SetContentTitle(message.GetNotification().Title)
                .SetContentText(message.GetNotification().Body)
                .SetSmallIcon(Resource.Drawable.logo)
                //.SetStyle((new NotificationCompat.BigTextStyle()))
                .SetStyle(new NotificationCompat.BigTextStyle().BigText(message.GetNotification().Body))
                .SetAutoCancel(true)
                .SetPriority((int)NotificationPriority.High)
                .SetVisibility((int)NotificationVisibility.Public)
                .SetDefaults(NotificationCompat.DefaultVibrate | NotificationCompat.DefaultSound)
                //.SetVibrate(new long[0])
                //.SetVibrate(new long[] { 300, 300, 300 })
                .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification));
                //.SetPriority(NotificationCompat.PriorityMax)
                //.SetColor(0x9c6114)
                //.SetSound(urgentAlarmUri, (int)alarmAttributes) // Loke
                //.SetVibrate(urgentVibrationPattern) // Loke
                //.SetSound(Android.Net.Uri.Parse("android.resource://InstaConsumer.Droid/Assets/air_horn_big.mp3"))

                manager.Notify(id, notification.Build());
            }
            catch (Exception ex)
            {
            }
        }
コード例 #23
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     MainActivity.CurrentMainActivity.MsgListAdapter.AddReceiveMsg(message);
 }
コード例 #24
0
        public override void OnMessageReceived(RemoteMessage message)
        {
            var parameters   = new Dictionary <string, object>();
            var notification = message.GetNotification();

            if (notification != null)
            {
                if (!string.IsNullOrEmpty(notification.Body))
                {
                    parameters.Add("body", notification.Body);
                }

                if (!string.IsNullOrEmpty(notification.BodyLocalizationKey))
                {
                    parameters.Add("body_loc_key", notification.BodyLocalizationKey);
                }

                var bodyLocArgs = notification.GetBodyLocalizationArgs();
                if (bodyLocArgs != null && bodyLocArgs.Any())
                {
                    parameters.Add("body_loc_args", bodyLocArgs);
                }

                if (!string.IsNullOrEmpty(notification.Title))
                {
                    parameters.Add("title", notification.Title);
                }

                if (!string.IsNullOrEmpty(notification.TitleLocalizationKey))
                {
                    parameters.Add("title_loc_key", notification.TitleLocalizationKey);
                }

                var titleLocArgs = notification.GetTitleLocalizationArgs();
                if (titleLocArgs != null && titleLocArgs.Any())
                {
                    parameters.Add("title_loc_args", titleLocArgs);
                }

                if (!string.IsNullOrEmpty(notification.Tag))
                {
                    parameters.Add("tag", notification.Tag);
                }

                if (!string.IsNullOrEmpty(notification.Sound))
                {
                    parameters.Add("sound", notification.Sound);
                }

                if (!string.IsNullOrEmpty(notification.Icon))
                {
                    parameters.Add("icon", notification.Icon);
                }

                if (notification.Link != null)
                {
                    parameters.Add("link_path", notification.Link.Path);
                }

                if (!string.IsNullOrEmpty(notification.ClickAction))
                {
                    parameters.Add("click_action", notification.ClickAction);
                }

                if (!string.IsNullOrEmpty(notification.Color))
                {
                    parameters.Add("color", notification.Color);
                }
            }
            foreach (var d in message.Data)
            {
                if (!parameters.ContainsKey(d.Key))
                {
                    parameters.Add(d.Key, d.Value);
                }
            }

            AzurePushNotificationManager.RegisterData(parameters);
            CrossAzurePushNotification.Current.NotificationHandler?.OnReceived(parameters);
        }
コード例 #25
0
        public override void OnMessageReceived(RemoteMessage message)
        {
            var parameters   = new Dictionary <string, object>();
            var notification = message.GetNotification();

            if (notification != null)
            {
                if (!string.IsNullOrEmpty(notification.Body))
                {
                    parameters.Add("body", notification.Body);
                }

                if (!string.IsNullOrEmpty(notification.BodyLocalizationKey))
                {
                    parameters.Add("body_loc_key", notification.BodyLocalizationKey);
                }

                var bodyLocArgs = notification.GetBodyLocalizationArgs();
                if (bodyLocArgs != null && bodyLocArgs.Any())
                {
                    parameters.Add("body_loc_args", bodyLocArgs);
                }

                if (!string.IsNullOrEmpty(notification.Title))
                {
                    parameters.Add("title", notification.Title);
                }

                if (!string.IsNullOrEmpty(notification.TitleLocalizationKey))
                {
                    parameters.Add("title_loc_key", notification.TitleLocalizationKey);
                }

                var titleLocArgs = notification.GetTitleLocalizationArgs();
                if (titleLocArgs != null && titleLocArgs.Any())
                {
                    parameters.Add("title_loc_args", titleLocArgs);
                }

                if (!string.IsNullOrEmpty(notification.Tag))
                {
                    parameters.Add("tag", notification.Tag);
                }

                if (!string.IsNullOrEmpty(notification.Sound))
                {
                    parameters.Add("sound", notification.Sound);
                }

                if (!string.IsNullOrEmpty(notification.Icon))
                {
                    parameters.Add("icon", notification.Icon);
                }

                if (notification.Link != null)
                {
                    parameters.Add("link_path", notification.Link.Path);
                }

                if (!string.IsNullOrEmpty(notification.ClickAction))
                {
                    parameters.Add("click_action", notification.ClickAction);
                }

                if (!string.IsNullOrEmpty(notification.Color))
                {
                    parameters.Add("color", notification.Color);
                }
            }
            foreach (var d in message.Data)
            {
                if (!parameters.ContainsKey(d.Key))
                {
                    parameters.Add(d.Key, d.Value);
                }
            }

            //Fix localization arguments parsing
            string[] localizationKeys = new string[] { "title_loc_args", "body_loc_args" };
            foreach (var locKey in localizationKeys)
            {
                if (parameters.ContainsKey(locKey) && parameters[locKey] is string parameterValue)
                {
                    if (parameterValue.StartsWith("[") && parameterValue.EndsWith("]") && parameterValue.Length > 2)
                    {
                        var arrayValues = parameterValue.Substring(1, parameterValue.Length - 2);
                        parameters[locKey] = arrayValues.Split(',').Select(t => t.Trim()).ToArray();
                    }
                    else
                    {
                        parameters[locKey] = new string[] { };
                    }
                }
            }

            AzurePushNotificationManager.RegisterData(parameters);
            CrossAzurePushNotification.Current.NotificationHandler?.OnReceived(parameters);
        }
コード例 #26
0
        async Task SendNotificationAsync(RemoteMessage message)
        {
            string notificationType = message.Data["type"];
            string idAlarm          = message.Data["idAlarm"];
            string idRoom           = message.Data["idRoom"];
            string numRoom          = message.Data["numRoom"];
            string nomOccupant      = message.Data["occupant"];
            string triggerTime      = message.Data["triggerTime"];
            //Personnalisation du message de la notification
            string notifTitle   = "Nouvel appel en chambre " + numRoom + " !";
            string notifMessage = "Appel effectué à " + triggerTime;

            //S'il s'agit d'une notification de type nouvelle alarme
            if (notificationType.Equals("newAlarm"))
            {
                //Ajout de l'alarme dans la base de données locale
                AlarmItem alarm = new AlarmItem();
                alarm.IDAlarm     = int.Parse(idAlarm);
                alarm.Status      = false;
                alarm.Chambre     = numRoom;
                alarm.NomOccupant = nomOccupant;
                alarm.DtDebut     = triggerTime;

                AlarmItemManager.AddAlarm(alarm);

                Console.WriteLine(AlarmItemManager.GetAlarm(4).Chambre);
            }



            //Affichage de la notification que nous venons de configurer
            var intent = new Intent(this, typeof(Accueil));

            intent.AddFlags(ActivityFlags.ClearTop);
            var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);

            Notification.BigTextStyle textStyle = new Notification.BigTextStyle();

            //...
            textStyle.BigText(notifMessage);


            var notificationBuilder = new Notification.Builder(this)
                                      .SetContentTitle(notifTitle)
                                      .SetStyle(textStyle)
                                      .SetContentText(notifMessage)
                                      .SetPriority((int)Android.App.NotificationPriority.High)
                                      .SetDefaults(NotificationDefaults.Vibrate)
                                      .SetSmallIcon(Resource.Drawable.patient2)
                                      .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Alarm))
                                      .SetAutoCancel(true)
                                      .SetContentIntent(pendingIntent)
                                      .SetVisibility(NotificationVisibility.Public);



            if (notificationType.Equals("newAlarm") || (notificationType.Equals("support") && notifyNewSupport))
            {
                var notificationManager = NotificationManager.FromContext(this);
                notificationManager.Notify(int.Parse(idRoom), notificationBuilder.Build());
            }
        }
コード例 #27
0
 public PacketWriter()
 {
     packet  = new MemoryStream();
     writer  = new BinaryWriter(packet);
     message = RemoteMessage.Invalid;
 }
コード例 #28
0
 // Receive data message on iOS 10 devices.
 public void ApplicationReceivedRemoteMessage(RemoteMessage remoteMessage)
 {
     Console.WriteLine(remoteMessage.AppData);
 }
コード例 #29
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     base.OnMessageReceived(message);
     SendNotification(message.GetNotification().Body);
 }
コード例 #30
0
 public int version(RemoteMessage message)
 {
     return(1);
 }
コード例 #31
0
 public void OnMessageReceived(RemoteMessage remoteMessage)
 {
     OnMessageReceivedSuccess?.Invoke(remoteMessage);
 }
コード例 #32
0
 public PacketWriter()
 {
     packet = new MemoryStream();
     writer = new BinaryWriter(packet);
     message = RemoteMessage.Invalid;
 }
コード例 #33
0
 public override void OnMessageReceived(RemoteMessage message)
 {
     Log.Debug(TAG, "From: " + message.From);
     Log.Debug(TAG, "Notification Message Body: " + message.GetNotification().Body);
     androidNotification.CrearNotificacionLocal(message.GetNotification().Title, message.GetNotification().Body);
 }