Azure / azure-notificationhubs-xamarin

Azure Notification Hubs Sample for Xamarin Forms
MIT License
35 stars 23 forks source link

Facing issues with push notification data format/conversion #53

Open smobiledev opened 3 years ago

smobiledev commented 3 years ago

As a part migration form App Center Push,I have integrated "Microsoft.Azure.NotificationHubs.Client" into my xamarin forms solution.

It seems like there is an issue with Push notification info coming from Azure Notification Hub. For ex consider below PNTemplate :

{"aps":{"alert":"Notification Hub test notification","PNHeader":"PN Header Text"}, "Details":{"source":"s1","dest":"d1","time":"120 mins"}}

In the OnNotificationMessageReceived event, NotificationMessageReceivedEventArgs e e.Title getting as "Notification Hub test notification" , e.Body as null and e.Data coming as a Dict with 2 keys and 2 values.

The main problem I am facing is the formatted data coming with lot of special char like "","\n","<",">" even null values coming as "". And getting unicode chars like for space - \U00a0 and for degrees - \U00B0.

Any one has idea how to get rid of this type of data conversion.

Is there any proper way to convert above PNTemplate ,with the current implementation I need to handle so many things to remove above mentioned special chars.

I didn't found any samples in the Google, can anyone please provide client side code samples for formatting push notification data.