Package.GetAppInstallerInfo 메서드

정의

.appinstaller XML 파일 위치를 반환합니다. 앱의 .appinstaller XML 파일 위치를 검색해야 하는 경우 이 메서드를 사용합니다. 예를 들어 앱이 연결된 .appinstaller 파일에 URI를 공유해야 하는 경우에 유용합니다. 필요에 따라 URI에 인수를 추가할 수 있습니다.

public:
 virtual AppInstallerInfo ^ GetAppInstallerInfo() = GetAppInstallerInfo;
AppInstallerInfo GetAppInstallerInfo();
public AppInstallerInfo GetAppInstallerInfo();
function getAppInstallerInfo()
Public Function GetAppInstallerInfo () As AppInstallerInfo

반환

.appinstaller XML 파일 위치입니다.

Windows 요구 사항

디바이스 패밀리
Windows 10, version 1809 (10.0.17763.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v7.0에서 도입되었습니다.)

예제

다음 예제에서는 인수를 사용하여 .appinstaller URI를 생성하고 다른 사용자에게 URI를 보내는 이메일을 만듭니다. 이 예제 ComposeEmailAsync 에서 메서드는 다른 곳에서 정의되는 것으로 간주됩니다.

AppInstallerInfo info = Windows.ApplicationModel.Package.Current.GetAppInstallerInfo();
if (info != null)
{
    // Uri that was used to install the app.
    // Example: http://contoso/connect4.appinstaller.
    Uri appInstallerUri = info.Uri;

    // Create the inner URI which uses a protocol handled by your app, passing any arguments needed in it 
    UriBuilder innerUriBuilder = new UriBuilder("my-app-protocol:");
    innerUriBuilder.Query = "difficulty=hard&highscore=9000";

    // Create outer URI builder for ms-appinstaller initializer link.
    UriBuilder outerUriBuilder = new UriBuilder("ms-appinstaller:");
    outerUriBuilder.Query =
        $"source={Uri.EscapeDataString(appInstallerUri.ToString())}&activationUri={Uri.EscapeDataString(innerUriBuilder.ToString())}";

    await ComposeEmailAsync(/* To */ colleagueEmail, /* Subject */ "Beat my high score!",
        /* Body */ outerUriBuilder.ToString());
}

설명

현재 앱과 연결된 .appinstaller 파일에 URI를 가져와서 사용자와 URI를 공유할 수 있도록 하려면 이 메서드를 사용합니다. 앱이 없는 사용자가 URI를 클릭하면 앱의 설치 프로세스를 통해 수행됩니다. 앱이 이미 있는 사용자가 URI를 클릭하면 필요한 경우 앱이 업데이트된 다음 열립니다.

필요에 따라 URI에 인수를 추가할 수 있습니다. 이 경우 동작은 위에서 설명한 것과 동일하지만 앱이 열리면 인수를 사용할 수 있습니다. 인수는 앱이 지원하는 프로토콜을 사용해야 합니다. 자세한 내용은 URI 활성화 처리를 참조하세요.

적용 대상

추가 정보