Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to display images that i will receive from my back end through AZURE NOTIFICATION HUB

$
0
0

I am trying to send an image along with notification from my backend code, i need to dispaly it in UI. I am not using service extension, and i am using UserNotificationCenterDelegate. i dont want as it is given in below url:

https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/advanced-user-notifications?tabs=windows#adding-media-attachments

this is my code:
public override void DidReceiveRemoteNotification(
UIApplication application,
NSDictionary userInfo,
Action completionHandler)
{
NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary;

        NSDictionary DetailedInfo = aps.ObjectForKey(new NSString("alert")) as NSDictionary;

        NSDictionary custom = userInfo.ObjectForKey(new NSString("custom")) as NSDictionary;


        var messageTitle = new NSString("title");
        var messageBody = new NSString("body");
        var orderid = new NSString("orderid");
        var pagetonavigate = new NSString("page");
        var notificationDBid = new NSString("notificationDbId");

        LinkNavigation linkNavigation = new LinkNavigation();

        string message = null, orderId = null,page=null,notificationid = null;
        if (DetailedInfo.ContainsKey(messageBody))
        {
            message = (DetailedInfo[messageBody] as NSString).ToString();
        }

        if (custom.ContainsKey(orderid))
        {
            orderId = (custom[orderid] as NSString).ToString();
            if (!string.IsNullOrEmpty(orderId))
            {
                linkNavigation.OrderId = orderId;
            }
            else linkNavigation.OrderId = null;
        }

        if (custom.ContainsKey(pagetonavigate))
        {
            page= (custom[pagetonavigate] as NSString).ToString();
            if (!string.IsNullOrEmpty(page))
            {
                linkNavigation.Pagename = Convert.ToInt16(page);
            }
        }

        if (custom.ContainsKey(notificationDBid))
        {
            notificationid = (custom[notificationDBid] as NSString).ToString();
            if (!string.IsNullOrEmpty(notificationid))
            {
                NotificationReadUnread(long.Parse(notificationid));
            }
        }

        if (!string.IsNullOrEmpty(orderId) || !string.IsNullOrEmpty(page))
        {
            LoadApplication(new App(linkNavigation));
        }
    }

Thanks in adv.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>