Topic
3 replies Latest Post - ‏2012-10-05T05:08:19Z by SystemAdmin
SystemAdmin
SystemAdmin
2327 Posts
ACCEPTED ANSWER

Pinned topic Direct update behavior - JSON response, WebResourcesDownloader

‏2012-09-25T16:32:59Z |
Hello,

I have created an application to remotely load dynamic content (guided by module 45.1), but I want to consider making use of some client side web content. I am seeing 2 different issues with direct update. In order to trigger the update, I am making a simple change to a client-side HTML file.

1) On Android, the JSON response to the /android/init request appears to be missing the gadgetProps.directUpdate object. It appears that the skin name parameter in the request is empty. If the request contains the skin name (e.g. "default" for iOS), the response will contain the directUpdate object.
The getCurrentSkinName (worklight.js) function attempts to retrieve 'wlSkinName' from the user preferences, which in my case skinName is an empty string, so I suspect wlSkinName was never set. Currently, the application is not using skins, would be necessary to setup a skin?

if (WL.Client.getEnvironment() === WL.Env.ANDROID) {
skinName = WL.App.readUserPref('wlSkinName');
}

2) As a workaround, for Android I set skinName="default" if the value from user preferences is empty, which allows me to get beyond that issue.
However, when I attempt to download the update, the app hits an exception on Android as well as iOS. For iOS the message is "Start downloading update file." then, "Fatal error updating application. Can't open downloaded zip file". I have attached the Android log.
Could something have gone wrong in the WebResourcesDownloader plugin?

Thanks!

Installation type: Developer Edition
Eclipse: EE 3.7.2
Worklight plug-in: v5.0.2.407-developer-edition
Environment details: iOS simulator v5.0, Android emulator (2.2)
  • jaalger
    jaalger
    24 Posts
    ACCEPTED ANSWER

    Re: Direct update behavior - JSON response, WebResourcesDownloader

    ‏2012-10-01T15:44:46Z  in response to SystemAdmin
    Alan,

    I am looking into this issue right now and I will respond to you as soon as I have discovered some more information.

    Regards,
    Joshua
  • jaalger
    jaalger
    24 Posts
    ACCEPTED ANSWER

    Re: Direct update behavior - JSON response, WebResourcesDownloader

    ‏2012-10-02T18:17:52Z  in response to SystemAdmin
    I have two questions with your issue that may help me better understand what you are seeing.

    1)Could you please elaborate on your process of "for Android I set skinName="default" if the value from user preferences is empty"
    -Which file did you edit? (skinLoader.html, worklight.js...)
    -How did you edit it?

    2)Was the direct update working on iOS before you made the modifications or did you see the same exact problem as you have described?

    I am still investigating and testing this issue, but I may be able to solve the problem easier if I knew these further details.

    Regards,
    Joshua
    • SystemAdmin
      SystemAdmin
      2327 Posts
      ACCEPTED ANSWER

      Re: Direct update behavior - JSON response, WebResourcesDownloader

      ‏2012-10-05T05:08:19Z  in response to jaalger
      Hi Joshua,

      Thanks for looking into this.

      1) My workaround for Android was to make the following change in worklight.js, since I found WL.App.readUserPref('wlSkinName') was returning an empty string.

      if (WL.Client.getEnvironment() === WL.Env.ANDROID) {
      skinName = WL.App.readUserPref('wlSkinName');
      //AL workaround
      if (skinName.length == 0) {
      skinName = "default";
      }
      } ...
      2) I can clarify, on the remote server with the web content, I have a separate copy of worklight.js for iOS from that for Android, which does not have the above workaround. I was seeing a direct update prompt, but it would fail with the message from my original post.
      I have noticed the same error on a more recent project. I am currently trying to back track to what may have been introduced and will try to provide more details.