0

noNetwork and no connection icon displayed on dock

HI There,

I've been using the Konfablator 1.1 framework simulator (wdk_0.9.5-33) and also running on the Samsung TV.

I'm slightly unclear on the requirements for Yahoo Certification "Disconnected State" critera based on the code samples and the response to the following
http://developer.yahoo.net/forum/index.php...hl=disconnected forum message.

Is it a requirement to display the no connection icon in the dock -- since under certain conditions we don't seem to be getting any global message that the network is down, and we don't consider some of the network connection errors that can occur enough to trigger this response (as other example widgets do). We do present the user with an error screen when it takes too long to connect to the server (which we expect may occur occasionally).

The specific case which seems to fail for us is when a user disables the network there doesn't appear to be a global message sent to all widgets in this case that the network is down -- So our widget only sees all server requests timeout, but does not consider this enough to signal a noNetwork state, will it need to do this to pass certification?

I believe the disconnected icon on the dock is triggered by the following message
KONtx.HostEventManager.send("setIcons", ['noNetwork']);
Which in some example widgets is triggered any time the widget cannot connect but in the widget gallery code it uses KONtx.event.Delegate('NetworkDisconnected'); which I was under the impression was deprecated -- am I wrong?

It was also brought to my attention that Page 87 of the developers guide dicusses need to register for the registerNetworkStatusChange callback -- but I don't see where that is used in any example widgets, nor any example of tv.system.getNetworkStatus. We do check for 'noNetwork' events but I'm not sure if this is the same thing.

Thanks,
-Raj

by
22 Replies
  • The correct way to handle the networkDisconnect in Framework 1.1 is the following:

    When a network request fails that prevents you from showing the normal user experience, call this:

    KONtx.application.setNetworkRequestFailed(true);

    When a network request succeeds, call this to ensure you are in the proper state:

    KONtx.application.setNetworkRequestFailed(false);

    Also, in the "default" view of your application, you should check the following:

    KONtx.application.getNetworkDownStatus()

    If it returns true, then that means the network was down previously and you should try to fire off a request. If you don't retry in this manner, the user will not be able to use your widget until they restart the TV.

    -Jeremy
    0
  • HI Jeremy,

    Using the Simulator (wdk_0.9.5-33) I get the following error when trying to use the function you suggested.

    "WE 00:00:15:371: [T:22162] TypeError: KONtx.application.getNetworkDownStatus is not a function"

    Also, I don't see KONtx.application.setNetworkRequestFailed() or KONtx.application.getNetworkDownStatus() in /usr/local/Konfabulator/TV/Framework/kontx/1.1/src/core/application.js

    Am I doing something wrong?

    Thanks,
    -Raj





    QUOTE (Jeremy Johnstone @ May 21 2009, 08:10 PM) <{POST_SNAPBACK}>
    The correct way to handle the networkDisconnect in Framework 1.1 is the following:

    When a network request fails that prevents you from showing the normal user experience, call this:

    KONtx.application.setNetworkRequestFailed(true);

    When a network request succeeds, call this to ensure you are in the proper state:

    KONtx.application.setNetworkRequestFailed(false);

    Also, in the "default" view of your application, you should check the following:

    KONtx.application.getNetworkDownStatus()

    If it returns true, then that means the network was down previously and you should try to fire off a request. If you don't retry in this manner, the user will not be able to use your widget until they restart the TV.

    -Jeremy
    0
  • QUOTE (mungumbo @ May 22 2009, 07:39 AM) <{POST_SNAPBACK}>
    HI Jeremy,

    Using the Simulator (wdk_0.9.5-33) I get the following error when trying to use the function you suggested.

    "WE 00:00:15:371: [T:22162] TypeError: KONtx.application.getNetworkDownStatus is not a function"

    Also, I don't see KONtx.application.setNetworkRequestFailed() or KONtx.application.getNetworkDownStatus() in /usr/local/Konfabulator/TV/Framework/kontx/1.1/src/core/application.js

    Am I doing something wrong?

    Thanks,
    -Raj


    My apologies, that wasn't in the -33 build yet. We have a WDK release in imminent release mode now, but please send me an email and I will assist you offline to get working soon. My contact info is in most of the sticky posts at the top of the forum.

    -Jeremy
    0
  • QUOTE (Mike @ Jul 22 2009, 10:21 AM) <{POST_SNAPBACK}>
    Bumping this subject,

    I've got an email in to Yahoo about this - but from a quick search looks like this could be something that more people would like to see answered.


    I would like help on this topic as this is something almost every widget (accessing network) needs to follow.
    Please help.

    Thanks,
    Ashish Jain
    0
  • Hello All,

    For noNetwork handling the following things need to be done to be in compliance:

    1.) Listen to the onNetworkRestored and onNetworkConnectionReconnect events off of KONtx.application and fetch any data your app needs. For example, if you fetch and cache a set of data when your application starts up, you should fetch the same data here as your app might have not had network access when started and thus not have good data.

    2.) When you fire off an API query and it succeeds, call the following method:

    CODE
    KONtx.application.setNetworkRequestFailed(false);


    When it fails, call this method instead:

    CODE
    KONtx.application.setNetworkRequestFailed(true);


    3.) Inside the updateView for any "entry point" into your application (aka any view which the user accessed via a click on a snippet), you need to see if the network was previously down and if so, fire off a network request to see if it's still down. Sample:

    CODE
    updateView: function() {
    if(KONtx.application.getNetworkDownStatus) {
    // fire off an API request
    }
    // rest of your updateView code
    }


    You could also/instead do this inside your snippet too if you like, the point is that we need something that fires off a request which detects if the network is back up or not as the user will always be blocked from using the widget until that happens.
    0
  • Hi Jeremy,
    I have some query about the implementation which I have done for Network Disconnection handling. Please could you provide an insight that this suffice or it can be better somehow.

    Am a bit confused about registering onNetworkRestored and onNetworkConnectionReconnect, thus in order to bypass :DAshish Jain
    0
  • QUOTE (ashish @ Jul 29 2009, 06:41 AM) <{POST_SNAPBACK}>
    Please let me know if I go with this implementation, is it fine as far as network connection check is concerned? In case not then I would request to make a bit clear what to do.


    No, your implementation doesn't fit the requirements as it doesn't handle all cases appropriately and actually potentially causes unnecessary traffic and additional delays in the user experience.

    If you have specific questions about what I described previously, ask, please don't just try and work around it with differing solutions.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jul 29 2009, 11:43 AM) <{POST_SNAPBACK}>
    No, your implementation doesn't fit the requirements as it doesn't handle all cases appropriately and actually potentially causes unnecessary traffic and additional delays in the user experience.

    If you have specific questions about what I described previously, ask, please don't just try and work around it with differing solutions.

    -Jeremy


    Thanks Jeremy. I will work on the mentioned solution and in case of any issues will take your help.

    Thanks for clarification.
    Ashish Jain
    0
  • Hi Jeremy,
    I tried and implemented what you said as follows, please let me know in case am still making it wrong.
    Taking the eventHandlers implementation from YahooFinance Widget defined eventHandlers.

    CODE
    EventHandlers = {
    onNetworkRestored:function()
    {
    log("##### restored network!");
    },
    onNetworkConnectionReconnect: function()
    {
    log("##### Reconnects!");
    },
    messageHandler: function(event){
    log("##### in Message Handler!");
    if (event.payload.key == 'noNetwork') {
    log("##### in no network Handler!");
    if (event.payload.value) {
    log("##### in network is down!");
    // network down
    this.networkWasDown = true;
    KONtx.HostEventManager.send("setIcons", ['noNetwork']);
    if (!this.noNetworkDialog) {
    var self = this;
    this.noNetworkDialog = new KONtx.dialogs.Alert({
    title: 'Network!',
    message: 'Network not available.',
    buttons: [{
    label: 'OK',
    callback: function(){
    log("Exiting to dock!");
    self.noNetworkDialog = null;
    KONtx.HostEventManager.send("exitToDock");
    }
    }]
    });
    }
    this.noNetworkDialog.show();
    }
    else {
    log("##### in network is up!");
    // network up
    if (this.networkWasDown) {
    this.networkWasDown = false;
    KONtx.HostEventManager.send("setIcons", '');

    if (this.noNetworkDialog && this.noNetworkDialog.show.call) {
    this.noNetworkDialog.hide();
    this.noNetworkDialog = null;
    }
    }
    }
    }

    }

    }


    Mine init.js file

    CODE
    EventHandlers.messageHandler.subscribeTo(KONtx.messages,KONtx.messages.eventType,EventHandlers);
    EventHandlers.onNetworkRestored.subscribeTo(KONtx.application,['onNetworkRestored'],EventHandlers);
    EventHandlers.onNetworkConnectionReconnect.subscribeTo(KONtx.application,['onNetworkConnectionReconnect'],EventHandlers);


    then a common function which is used by whole widget to call API has been made like this:
    CODE
        callAPI: function(){
    var i = 0;
    for (var param in this.params) {
    if (this.params.hasOwnProperty(param)) {
    if (i == 0) {
    this.url.fullUrl = this.url().baseAddress + param + '=' + this.params[param];
    }
    else
    this.url.fullUrl = this.url.fullUrl + '&' + param + '=' + this.params[param];
    i++;
    }
    }
    var u = new URL();
    u.location = this.url.fullUrl;
    log('Full URL is:' + this.url.fullUrl);
    var response = u.fetch();
    this.jsonResponse = response;
    if (BIGFlix.Format.contains(response, "Could not load URL")) {
    log("######Am setting networkRequestFailed true");
    KONtx.application.setNetworkRequestFailed(true);
    }
    else {
    log("######Am setting networkRequestFailed false");
    KONtx.application.setNetworkRequestFailed(false);
    }
    },


    I looked at the core/application.js of Framework and found that in the list of Subscribable events the following are there:

    CODE
    var subscribeableApplicationEvents = [
    'onActivateBackButton',
    'onActivateHomeButton',
    'onActivateFavButton',
    'onActivateSettingsButton',
    'onActivateSnippet',
    'onLoadView',
    'onUnloadView',
    'onShowView',
    'onHideView',
    'onSelectView',
    'onUnselectView',
    'getSnippetConfs',
    'onDialogCancelled',
    'onDialogDone',
    'onApplicationStartup',
    'onApplicationShutdown',
    'onLoadProfile',
    'onUnloadProfile',
    'onWidgetKeyPress',
    'onPlayControlKeyPress',
    'onViewChangeInitiated',
    'onCountryCodeChanged',
    'onYahooLoginChanged',
    'getProfileSnippetConfs',
    ];


    I could not see the log generated when I am out of network or reconnect it, what else needs to be done for the same?

    Thanks,
    Ashish Jain
    0
  • What version of the WDK are you running? I think you are running a very old version.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jul 30 2009, 05:21 PM) <{POST_SNAPBACK}>
    What version of the WDK are you running? I think you are running a very old version.

    -Jeremy


    Hi Jeremy,
    Yes I think I have the older version, ywe-wdk_0.9.5-33_i386.deb file I installed.

    I have mailed a request for new WDK and got the response from Roger that Russ will send it to me, but I could not get it still.
    Please provide me the latest WDK so that in case any other changes (if required) to the widget can be done.

    Please look into Ticket ID: 263 for sending me the WDK (My EmailID is mentioned in the Ticket).

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Jul 30 2009, 10:33 PM) <{POST_SNAPBACK}>
    Hi Jeremy,
    Yes I think I have the older version, ywe-wdk_0.9.5-33_i386.deb file I installed.

    I have mailed a request for new WDK and got the response from Roger that Russ will send it to me, but I could not get it still.
    Please provide me the latest WDK so that in case any other changes (if required) to the widget can be done.

    Please look into Ticket ID: 263 for sending me the WDK (My EmailID is mentioned in the Ticket).

    Thanks,
    Ashish Jain


    Hi Jeremy,
    Please could you provide me the WDK, I have not received yet.

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Aug 2 2009, 10:16 PM) <{POST_SNAPBACK}>
    Please could you provide me the WDK, I have not received yet.


    I have pinged Russ again. I apologize, but I don't handle delivery of official framework drops.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Aug 3 2009, 10:53 AM) <{POST_SNAPBACK}>
    I have pinged Russ again. I apologize, but I don't handle delivery of official framework drops.

    -Jeremy


    Thanks Jeremy,
    I got the new WDK, I installed it and once installing I found that the disconnect icon is being observed at the SIDEBAR once I am unable to hit my server API.
    Also another issue which was related to scroll of tab strips which Keville was looking into has also been solved.

    Thanks a lot for the help.

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Aug 5 2009, 11:10 PM) <{POST_SNAPBACK}>
    Thanks Jeremy,
    I got the new WDK, I installed it and once installing I found that the disconnect icon is being observed at the SIDEBAR once I am unable to hit my server API.
    Also another issue which was related to scroll of tab strips which Keville was looking into has also been solved.

    Thanks a lot for the help.

    Thanks,
    Ashish Jain

    Hi Jeremy,

    could you please provide me the latest WDK deb file since even i have been facing the onNetworkRestored event Listener Issue.EMail Id : k.prajwalshetty@igate.com.
    0
  • QUOTE (ashish @ Aug 5 2009, 11:10 PM) <{POST_SNAPBACK}>
    Thanks Jeremy,
    I got the new WDK, I installed it and once installing I found that the disconnect icon is being observed at the SIDEBAR once I am unable to hit my server API.
    Also another issue which was related to scroll of tab strips which Keville was looking into has also been solved.

    Thanks a lot for the help.

    Thanks,
    Ashish Jain

    Hi ashish,

    could you please mail the latest deb file to my mail id prajwalaug7@gmail.com

    Regards,
    Prajwal
    0
  • The proper way to get the WDK is to email tvwidgets@yahoo-inc.com.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Dec 10 2009, 12:41 PM) <{POST_SNAPBACK}>
    The proper way to get the WDK is to email tvwidgets@yahoo-inc.com.

    -Jeremy



    Hello All,

    I am having some issues with handling network disconnectivity

    1) for network connectivity , I am following exactly the same approach , which is coded in the News widget . After disconnecting the network the connection unavailable message is popping up fine but the event "onNetworkRestored,onNetworkConnectionReconnect" is not firing .

    2) In my widget we are not sending the request on the first screen(I.e the screen which comes immediately after clicking on dock snippet ) instead we are sending the request from the second screen. Is it possible or there is any change in the logic for implementing network handling?


    Can anyone help me in this regard?

    Thanks in advance.
    0
  • Which TV are you testing on?

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jul 30 2010, 10:10 AM) <{POST_SNAPBACK}>
    Which TV are you testing on?

    -Jeremy


    Hello Jermy,

    The TV I am testing on is US SAMSUNG
    WDK : 0.9.7.6
    Framework : 1.2
    0
  • QUOTE (AMIT @ Aug 1 2010, 09:44 PM) <{POST_SNAPBACK}>
    Hello Jermy,

    The TV I am testing on is US SAMSUNG
    WDK : 0.9.7.6
    Framework : 1.2


    Which model TV?

    -Jeremy
    0
  • QUOTE (AMIT @ Aug 1 2010, 09:44 PM) <{POST_SNAPBACK}>
    Hello Jermy,

    The TV I am testing on is US SAMSUNG
    WDK : 0.9.7.6
    Framework : 1.2


    Also, you are on a very old WDK. You really should upgrade. :)-Jeremy
    0

Recent Posts

in General - Yahoo! TV Widgets