×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Is Widget On Homescreen?

    Is there a way to know, if the widget has been placed on homescreen when the app is in full view? Or is the only way to follow onresize() event and store it to global variable if it ever goes to homescreen?

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Is Widget On Homescreen?

    Hello,

    Well not really. You could check if the widget is killed between onexit events. If it is on HS you get onexit event whenever the widget is minimized, but if it is not in the HS the onexit is the last thing that your widget sees. Or you could track the onresize event as you proposed.

    There is no way to tell if your widget is placed on hs, just after it has been started from applications menu. And apparently in N8 if the widget is in homescreen, but has not been loaded (loading indicator is shown on top of the widget when switched to page that contains the widget), the widget launched from application menu acts as any regular widget with no HS connection.

    Br,
    Ilkka

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Question Re: Is Widget On Homescreen?

    If widget is put to home screen, it will always get onresize()-event as a first event or at least in matter of seconds after widget is been executed? Even after reboot, right? And also when it's first placed there?

    Code:
    var HOMESCEEN_ENABLED = false;
    
    window.onresize = windowResized;
    
    function windowResized() {
        if (window.innerHeight < 150)
        {
            HOMESCEEN_ENABLED = true;
        }
    }

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Is Widget On Homescreen?

    Window onresize is only fired if the size really changes. In case of the reboot or adding the widget on HS first time, you won't get onresize event until you tap the widget on HS to make it full screen.
    So what needs to be done is to check the initial state on window.onload handler.
    Code:
    window.onload = function(){
      .....
       windowResized();
    }
    Br,
    Ilkka

Similar Threads

  1. Homescreen Widget Timers
    By nik.rolls in forum Symbian
    Replies: 2
    Last Post: 2010-08-21, 01:55
  2. Homescreen widget appearance
    By grahamhughes in forum Symbian
    Replies: 2
    Last Post: 2010-03-20, 16:01
  3. homescreen widget publishing
    By gavrix in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-08-25, 08:55
  4. Replies: 1
    Last Post: 2009-08-06, 04:45
  5. what is a homescreen widget ?
    By yosr eman in forum General Development Questions
    Replies: 4
    Last Post: 2009-03-04, 14:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×