The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[W8.1]LaunchUriAsync and LaunchFileAsync broken in 10586? RRS feed

  • Question

  • Hi,

    I have a pair of WP8.1 apps that use LaunchUriAsync and LaunchFileAsync to exchange data. Everything works fine in WP8.1 and Windows 10 Mobile Build 10240. But now I have users of a Lumia 950(xl) reporting build 10586 and failures when launching the other app. I was able to reproduce in the emulator that in build 10240 exchanging data works and in 10586 both calls return false in the same scenario.

    I didn't find any documented changes for 10586.Any idesa?

    Thomas



    • Edited by Krunal Parekh Tuesday, December 8, 2015 4:53 AM subject
    Monday, December 7, 2015 7:15 PM

Answers

  • Hello t_s_b,

    Yes I tried again after uncommenting the second protocol and its works fine on my side.

         <Extensions>
            <FileTypeAssociation Name="Windows Phone SDK test file type" TaskID="_default" NavUriFragment="fileToken=%s">
               <Logos>
                  <Logo Size="small" IsRelative="true">Assets/sdk-small-33x33.png</Logo>
                  <Logo Size="medium" IsRelative="true">Assets/sdk-medium-69x69.png</Logo>
                  <Logo Size="large" IsRelative="true">Assets/sdk-large-176x176.png</Logo>
               </Logos>
               <SupportedFileTypes>
                  <FileType ContentType="application/sdk">.sdkTest1</FileType>
                  <FileType ContentType="application/sdk">.sdkTest2</FileType>
               </SupportedFileTypes>
            </FileTypeAssociation>
            <Protocol Name="sdkautolaunch1" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
            <Protocol Name="sdkautolaunch" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
         </Extensions>

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Krunal Parekh Monday, December 28, 2015 8:35 AM
    • Marked as answer by Fred Bao Wednesday, December 30, 2015 9:28 AM
    Monday, December 21, 2015 8:36 AM

All replies

  • Hello Thomas,

    >> I was able to reproduce in the emulator that in build 10240 exchanging data works and in 10586 both calls return false in the same scenario. I didn't find any documented changes for 10586.Any idesa?

    var result = await Windows.System.Launcher.LaunchUriAsync(new Uri(http://www.google.com));

    &

    var storagefile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Assets\\Logo.scale-240.png");
    var result = await Windows.System.Launcher.LaunchFileAsync(storagefile);

    I Tested this both in the 10586 Emulator but I was not able to reproduce the issue. Both times it returned true to me. LauchFileAsync successfully opened the image viewer and LaunchUriAsync successfully opened the IE.

    With Regareds,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, December 8, 2015 5:21 AM
  • I didn't use general purpose Uris but registered my second app as Uri association and file handler for my file extension. Maybe something with the URI association / file handler registration is broken.

    Tuesday, December 8, 2015 10:25 AM
  • In the receiving WP8.1 (Silverlight) app, I have registered the associations in the WMAppmanifest and not in the Package.appxmanifest. That works well under WP8.1.

    Does a WP8.1 app running under W10M need more/other registration? I understand that a UWP app needs registration in the package manifest under <uap:Extension> but that does not match my case.

    W10M should emulate/interpret the WMappManifest correctly, right?


    • Edited by t_s_b Thursday, December 10, 2015 4:43 PM
    Wednesday, December 9, 2015 7:24 AM
  • Hello t_s_b,

    I tested this on windows 10 mobile 10.0.10586 emulator by creating windows phone 8.1 Silverlight application. I used this walkthrough.

    Auto-launching apps using file and URI associations for Windows Phone 8 

    And it seems to work fine on windows 10 mobile emulator. I just modified the WMAppmanifest and put the UriMapper Class as explained.

    Could you check this on your side using the above article?

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, December 11, 2015 3:37 AM
  • Hi Krunal,

    I was able to reproduce it working on 10586 using the walkthrough.

    BUT: My case uses TWO URI protocols in the manifest and when I include a second protocol in 10586 neither the file nor the URI associations work anymore!

    Looks like the second protocol breaks the LaunchUriAsync and LaunchFileAsync APIs.

    Here's the Extensions block I used:

         <Extensions>
            <FileTypeAssociation Name="Windows Phone SDK test file type" TaskID="_default" NavUriFragment="fileToken=%s">
               <Logos>
                  <Logo Size="small" IsRelative="true">Assets/sdk-small-33x33.png</Logo>
                  <Logo Size="medium" IsRelative="true">Assets/sdk-medium-69x69.png</Logo>
                  <Logo Size="large" IsRelative="true">Assets/sdk-large-176x176.png</Logo>
               </Logos>
               <SupportedFileTypes>
                  <FileType ContentType="application/sdk">.sdkTest1</FileType>
                  <FileType ContentType="application/sdk">.sdkTest2</FileType>
               </SupportedFileTypes>
            </FileTypeAssociation>
            <!--<Protocol Name="sdkautolaunch1" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />-->
            <Protocol Name="sdkautolaunch" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
         </Extensions>
    
     

    When uncommenting the first protocol no more launching works.

    I think the mystery is solved and the bug in W10M located!

    Regards,

    Thomas

    Sunday, December 13, 2015 6:53 PM
  • Hello t_s_b,

    I tested your scenario on my windows 10 emulator and its works fine.

    private async void Button_Click(object sender, RoutedEventArgs e)
    		{
    			// Get the app's installation folder.
    			StorageFolder appFolder =
    					Windows.ApplicationModel.Package.Current.InstalledLocation;
    
    
    			var file = await appFolder.GetFileAsync("1.sdkTest1");
    
    			await Windows.System.Launcher.LaunchFileAsync(file);
    
    			var file2 = await appFolder.GetFileAsync("1.sdkTest2");
    
    			await Windows.System.Launcher.LaunchFileAsync(file2);
    		}
    

    I just called the two files with LauchFileAsyc and both time I could see that my app is launching fine and my URI Mapper is working perfectly and receiving file id.

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, December 16, 2015 3:41 AM
  • Hello Krunal,

    I fear you misunderstood me. I said when I uncomment the first protocol, that's 'sdkautolaunch1', nothing else works. The two file type don't pose a problem.

    Regards,

    Thomas

    Wednesday, December 16, 2015 10:19 AM
  • I uploaded my sample project if that helps. Please see http://1drv.ms/1RTrmU8

    The solution has 4 projects, 2 each for UWP and Silverlight.

    The important ones are the Silverlight projects, sdkLaunch and sdkAutoLaunch. sdkLaunch is supposed to start sdkAutoLaunch on button click. Works on WP8.1 but on W10M the 2nd app can't be started.

    • Edited by t_s_b Thursday, December 17, 2015 7:15 AM typo
    Thursday, December 17, 2015 7:14 AM
  • Hello t_s_b,

    I tested both your Silverlight project under Windows 10 Emulator 10.0.1586.0 and seems to work fine on my side.

    Did I miss something? Let me know if you have more info.

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, December 21, 2015 8:17 AM
  • Did you uncomment the sdkautolaunch1 protocol? Your screenshot implies not. The problem only arises when you uncomment the line and a second protocol is in effect.

    Monday, December 21, 2015 8:21 AM
  • Hello t_s_b,

    Yes I tried again after uncommenting the second protocol and its works fine on my side.

         <Extensions>
            <FileTypeAssociation Name="Windows Phone SDK test file type" TaskID="_default" NavUriFragment="fileToken=%s">
               <Logos>
                  <Logo Size="small" IsRelative="true">Assets/sdk-small-33x33.png</Logo>
                  <Logo Size="medium" IsRelative="true">Assets/sdk-medium-69x69.png</Logo>
                  <Logo Size="large" IsRelative="true">Assets/sdk-large-176x176.png</Logo>
               </Logos>
               <SupportedFileTypes>
                  <FileType ContentType="application/sdk">.sdkTest1</FileType>
                  <FileType ContentType="application/sdk">.sdkTest2</FileType>
               </SupportedFileTypes>
            </FileTypeAssociation>
            <Protocol Name="sdkautolaunch1" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
            <Protocol Name="sdkautolaunch" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
         </Extensions>

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Krunal Parekh Monday, December 28, 2015 8:35 AM
    • Marked as answer by Fred Bao Wednesday, December 30, 2015 9:28 AM
    Monday, December 21, 2015 8:36 AM
  • Sorry for my late response due to the holidays...

    NOW I can confirm the sample scenario works on my side. I don't know why it didn't for the first time.

    BUT my real app does not start using the same sample! What I found out meanwhile is, that if I use an incorrect protocol name, the search for app dialog comes up. If I use the correct uri protocol of my real app (that works on WP8.1) I just get a FALSE return from LaunchUriAsync under W10M. I don't get a search for app dialog, so the app seems to be found in the system but can't be started. A breakpoint in the app's ctor does not strike. The app runs fine otherwise.

    Any ideas?

    -Thomas

    Saturday, January 9, 2016 6:19 PM