Why CurrentApp::AppId take so long in Windows Phone 10?
Asked Answered
J

1

1

I have a windows 8 universal project and have a function to get APP ID, The following function works well in Windows Phone 8.1

Platform::Guid  appId = Windows::ApplicationModel::Store::CurrentApp::AppId;

however, it spent around 40s in Windows Phone 10.

From MSDN, only the Metadata is different,

May I know is it caused by the metadata? And how to solve it?

Jailbird answered 12/1, 2016 at 15:49 Comment(0)
D
0

To instead of using AppID, you might use the following code,

Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::ApplicationModel::PackageId^ packageId = package->Id;
Windows::ApplicationModel::PackageVersion version = packageId->Version;

Platform::String^ output = 
  "Name: \"" + packageId->Name + "\"\n" +
  "Version: " + version.Major.ToString() + "." 
              + version.Minor.ToString() + "." 
              + version.Revision.ToString() + "." 
              + version.Build.ToString() + "\n" +
  "Architecture: " + packageId->Architecture.ToString() + "\n" +
  "ResourceId: \"" + packageId->ResourceId + "\"\n" +
  "Publisher: \"" + packageId->Publisher + "\"\n" +
  "PublisherId: \"" + packageId->PublisherId + "\"\n" +
  "FullName: \"" + packageId->FullName + "\"\n" +
  "FamilyName: \"" + packageId->FamilyName + "\"\n" +
  "IsFramework: " + package->IsFramework.ToString();

Sample output from device

Output: Name: "f3e02737-ddfa-47a0-a837-37ee53459898" Version: 1.0.0.0 Architecture: Arm ResourceId: "" Publisher: "CN=heefan" PublisherId: "gsbawe9kfjm1p" FullName: "f3e02737-ddfa-47a0-a837-37ee53459898_1.0.0.0_arm__gsbawe9kfjm1p" FamilyName: "f3e02737-ddfa-47a0-a837-37ee53459898_gsbawe9kfjm1p" IsFramework: false

I also have no idea why AppID take long time to compute.

Dolomite answered 12/1, 2016 at 19:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.