locked
Issue in protocol activation when app is not running RRS feed

  • Question

  • Hi,

    I have created a protocol for the application. (say abc)

    Now when app is running, and i invoke protocol launch (Enter in run -> abc://), application works OK.

    When app is not running, and i invoke protocol launch, app is launched, but splash screen is displayed for very long, and ultimately app is suspended (i guess due to not starting in 15 sec).

    When app is launched normally from tile, or from the debugger, or in the simulator, app is running perfectly OK.

    What can be cause of app not getting launched from protocol activation.

    Another related question:

    1. Please specify whether OnActivated will be hit or not if app is launched through protocol activation.

    2. How to debug when app is launched through protocol activation


    mole on left eye

    Wednesday, May 16, 2012 10:51 AM

Answers

  • For tile invocation, the Application.OnLaunched override method will fire.

    For protocol activation, the Windows.UI.Xaml.Application.OnActivated(Windows.ApplicationModel.Activation.IActivatedEventArgs) will fire an in the ActivatedEventArgs you will see the Kind property which you can switch on to ensure (args.Kind == ActivationKind.Protocol). When that is the case, you should run your protocol activation code path there. Be sure to call Window.Current.Activate which will dismiss the splash screen.

     Can you confirm whether you are seeing this behavior.

    There are certain activations which have specific override methods, you can see the full list in the object browser of VS under the Application object in the Windows.UI.Xaml namespace. Other activations that are supported (shown via the ActivationKind enum), will fire the general OnActivated method. Protocol is one of these.


    Marco

    • Proposed as answer by Marco Matos Wednesday, May 16, 2012 5:49 PM
    • Marked as answer by tilakrajchandan Friday, May 18, 2012 8:03 AM
    Wednesday, May 16, 2012 5:33 PM

All replies

  • For tile invocation, the Application.OnLaunched override method will fire.

    For protocol activation, the Windows.UI.Xaml.Application.OnActivated(Windows.ApplicationModel.Activation.IActivatedEventArgs) will fire an in the ActivatedEventArgs you will see the Kind property which you can switch on to ensure (args.Kind == ActivationKind.Protocol). When that is the case, you should run your protocol activation code path there. Be sure to call Window.Current.Activate which will dismiss the splash screen.

     Can you confirm whether you are seeing this behavior.

    There are certain activations which have specific override methods, you can see the full list in the object browser of VS under the Application object in the Windows.UI.Xaml namespace. Other activations that are supported (shown via the ActivationKind enum), will fire the general OnActivated method. Protocol is one of these.


    Marco

    • Proposed as answer by Marco Matos Wednesday, May 16, 2012 5:49 PM
    • Marked as answer by tilakrajchandan Friday, May 18, 2012 8:03 AM
    Wednesday, May 16, 2012 5:33 PM
  • Hi,

      I used to Launch application through protocol it's work fine

      I have implemented the following steps  in our application

     1. Create protocol for target metro application

     2. Implement override method of OnActivated from base class

     3. Need to Check ActivatedEventArgs is protocol(args.Kind == ActivationKind.Protocol), if it's true then to navigate some page

     4. You should invoke LaunchUriAsync() with Uri of target installed path from source application

    can you check and if you have any problem revert back

    Loganathan.v





    Wednesday, July 25, 2012 1:39 PM
  • hey i am facing the same issue..

    I would like to brief you about the steps i am following to launch one ,metro app from other.

    I have three apps say app1 ,app2,app3

    i am calling app2 and app3 from app1.

    So i have created protocols for app2 and app3. by giving  custom protocol names in declaration tab of package.app-manifest  of app2 and app3.

    say for app2,  protocol is proto2:// and

    for app3 , protocol is proto3://

     Now to call app2 and app3 i write code in app1 on button click event of button1 and button2.

    for calling app2 and app3 respectively.

    The code is:

     private async void capture_Tapped(object sender, TappedRoutedEventArgs e)
            {
                var options = new Windows.System.LauncherOptions();
                options.TreatAsUntrusted = true;
                var ur1 = @"proto2://";
                Uri ur = new Uri(ur1);
                
                await Windows.System.Launcher.LaunchUriAsync(ur, options);
            }
    
            private async void Image_Tapped_1(object sender, TappedRoutedEventArgs e)
            {
                var options = new Windows.System.LauncherOptions();
                options.TreatAsUntrusted = true;
                var ur1 = @"proto3://";
                Uri ur = new Uri(ur1);
                  await Windows.System.Launcher.LaunchUriAsync(ur, options);
            }

    .I just want to make sure i am going correctly.

    After i do this i am facing the problem mentioned by tilakrajchandan.

    Where to handle the onActivated event in app1 or app2 and app3.

    Thanks in advance.



    • Edited by Anonymous_g Wednesday, September 12, 2012 12:45 PM
    Wednesday, September 12, 2012 12:44 PM