2016-04-20 167 views
1

我想從Windows Phone 8.1環境中的其他應用程序啓動我的應用程序。我遵循MSDN中的說明,但我無法弄清楚如何從第二個應用程序調用第一個應用程序。這是我的第一個應用程序的清單文件中添加的協議:如何從Windows Phone 8.1中的其他應用程序啓動應用程序

<Extensions> 
    <Extension Category="windows.protocol"> 
     <Protocol Name="myapp"> 
     <Logo>Assets\SmallLogo.scale-240.png</Logo> 
     <DisplayName>my App 1</DisplayName> 
     </Protocol> 
    </Extension> 
    </Extensions> 

這是第二應用我的電話,那也絕對沒有什麼:

private async void btn_Click(object sender, RoutedEventArgs e) 
    { 
     await Windows.System.Launcher.LaunchUriAsync(new System.Uri("myapp:")); 
    } 
+0

無法重現您的問題,我可以啓動目標應用程序。你已經部署了你的目標應用myapp嗎? –

回答

0

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

步驟並且您有使用使用派生自UriMapperBase的類來處理導航,並且必須在App.xaml.cs中將其設置爲RootFrame.UriMapper

private void InitializePhoneApplication() 
{ 
    if (phoneApplicationInitialized) 
     return; 

    // Create the frame but don't set it as RootVisual yet; this allows the splash 
    // screen to remain active until the application is ready to render. 
    RootFrame = new PhoneApplicationFrame(); 
    RootFrame.Navigated += CompleteInitializePhoneApplication; 

    // Assign the URI-mapper class to the application frame. 
    RootFrame.UriMapper = new AssociationUriMapper(); 

    ****** 
} 
相關問題