cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From progmars <progm...@gmail.com>
Subject Cordova applications on Windows Phone 8.1 - issues and workarounds
Date Thu, 22 May 2014 14:39:53 GMT
Hi all.

I'm a beginner with Cordova development and I wanted to share my 
experience and offer some code bits to fix them.

At first I think I found a bug. Here is full information:

http://stackoverflow.com/questions/23794121/ajax-responses-messed-up-in-cordova-application-on-windows-phone-8-1

I have no idea why it's the case - maybe Microsoft has changed something 
in Windows 8.1 and now the MiniBrowser_ScriptNotify calls are completely 
async.

I think the fix mentioned in 
https://issues.apache.org/jira/browse/CB-4873 should be implemented 
anyway because it seems more safe and correct solution to have a 
separate callback function for each request instead of the current 
single window.__onXHRLocalCallback. I added a comment there but I'm not 
sure whether to create a new ticket or Cordova team will reopen the 
existing one if necessary.


And some more info while looking forward to Windows Phone 8.1. I found 
that to build and deploy my Cordova app for Windows Phone 8.1 SDK, I had 
to change some things in the Cordova VS project template. At first, I 
had to add redirects for assemblies in CordovaDeploy.csproj file:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

Also, I had to change CordovaDeploy\Program.cs

GetIsolatedStore()
replace with
GetIsolatedStore(null)

And one more problem, maybe not related to WP8.1 but to the fact that 
I'm running the emulator in VMWare machine. Sometimes Corodova Deploy 
failed to access debugOutput.txt file on the emulator. I did some 
debugging and found out that it tries to access the file too soon. Thus 
I added some hacky workaround code:


string dbFilePath = Path.DirectorySeparatorChar + "debugOutput.txt";
int waitForFileToAppear = 0;
while (!isoFile.FileExists(dbFilePath))
{
     Thread.Sleep(1000);
     waitForFileToAppear++;
     if (waitForFileToAppear >= 60)
     throw new InvalidOperationException("Cannot wait for debug output 
file anymore");
}

and now it works fine.

I hope my code bits and experience will be useful for other developers 
and maybe some of the mentioned fixes will get into the Cordova source.

Regards,
Maris



Mime
View raw message