'UWP WinRT: App is launching in background instead of foreground when using API Windows::System::Launcher::LaunchUriAsync

I am using API Windows::System::Launcher::LaunchUriAsync API to launch a target app from within another app using protocol. But the target app is launching in background instead of foreground. Anything I need to do to launch the app in the foreground?

    auto appUri = Windows::Foundation::Uri(m_appLaunchProtocolUrl);
    auto appStatus = co_await Windows::System::Launcher::QueryUriSupportAsync(appUri, Windows::System::LaunchQuerySupportType::Uri, m_appPackageFamilyName);
    if (appStatus == Windows::System::LaunchQuerySupportStatus::Available)
    {
        co_await Windows::System::Launcher::LaunchUriAsync(Windows::Foundation::Uri(appUri));
        handled = true;
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source