illusionSun
illusionSun

Reputation: 11

windows phone 8.1 cordova plugins 4.2.0 open a local file

all

Use windows phone 8.0, this method was well,can launch files.

Windows.System.Launcher.LaunchFileAsync(localFile);

But , in windows phone 8.1 , this method was wrong: "Error HRESULT E_FAIL has been returned from a call to a COM component."

Please help.

Upvotes: 1

Views: 323

Answers (1)

Damir Zubanovic
Damir Zubanovic

Reputation: 11

I had the same problem, here is the solution i found out:

Deployment.Current.Dispatcher.BeginInvoke(async () =>
{
    var uri = new System.Uri("ms-appdata:///local/"+fileName);
    StorageFile file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
    if (file != null)
    {
    await Windows.System.Launcher.LaunchFileAsync(file);
    }
});

Upvotes: 1

Related Questions