Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to integrate iOS9 quick actions in a Xamarin Forms app?

$
0
0

Does anyone have an example on how to integrate ioS9 quick actions in the iOS part of a Xamarin Forms app?
It seems that it can not open the Xamarin Forms UI when the app starts from a quick action?
Any suggestions?

In the AppDelegate.cs class I have...

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();

        LoadApplication(new App());

        return base.FinishedLaunching(app, options);
    }

public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
{
Console.WriteLine("eeeeeeeeeee HandleShortcutItem ");
bool handled = false;

        // Anything to process?
        if (shortcutItem == null) return false;

        Console.WriteLine(shortcutItem.Type);

        // Take action based on the shortcut type
        switch (shortcutItem.Type)
        {
            case Pages.PAGE1:
                LoadApplication(new App(Pages.PAGE1)); // <= doesn't show UI but there's no error
                handled = true;
                break;
            case(Pages.PAGE2:
                LoadApplication(new App(Pages.PAGE2)); // <= doesn't show UI but there's no error
                handled = true;
                break;
            case Pages.PAGE3:
                LoadApplication(new App(Pages.PAGE3)); // <= doesn't show UI but there's no error
                handled = true;
                break;
            case Pages.PAGE4:
                LoadApplication(new App(Pages.PAGE4)); // <= doesn't show UI but there's no error
                handled = true;
                break;
        }

        Console.WriteLine(handled);
        // Return results
        return handled;
    }

    public override void OnActivated(UIApplication application)
    {
        Console.WriteLine("ccccccc OnActivated");

        // Handle any shortcut item being selected
        HandleShortcutItem(LaunchedShortcutItem);

        // Clear shortcut after it's been handled
        LaunchedShortcutItem = null;
    }

    // if app is already running
    public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
    {
        Console.WriteLine("dddddddd PerformActionForShortcutItem");
        // Perform action
        bool handled = HandleShortcutItem(shortcutItem);
        completionHandler(handled);
    }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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