Results 1 to 5 of 5
  1.    #1  
    I am in the process of making an app that requires two service calls, one for recieving the system time, and the other for recieveing the state of the display whether it be on or off and consequently launching 1 of two apps in response to either call. I've been trial and error-ing my code all night and cant seem to get it to work, so maybe you awesome devs can give me a pointer or two:

    this.controller.serviceRequest('palm://com.palm.display', {
    method:'status',
    parameters:{subscribe: true},
    onSuccess: (i need to launch an application based on whether the display 'state' returned from the 'status' method is on or off but dont know how)
    });

    and then:

    this.controller.serviceRequest('palm://com.palm.systemservice/time', {
    method:"getSystemTime",
    parameters:{subscribe: true},
    onSuccess: (i need to launch an app based on if the minutes returned from the 'getSystemTime' are less than 10)
    });


    any help is greatly appreciated, hopefully its not too much to ask for
  2.    #2  
    anyone?
  3. #3  
    Exactly which part is not working?

    Have you put a callback function in your onSuccess and been able to enter it?
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  4. #4  
    Quote Originally Posted by srath16 View Post
    I am in the process of making an app that requires two service calls, one for recieving the system time, and the other for recieveing the state of the display whether it be on or off and consequently launching 1 of two apps in response to either call. I've been trial and error-ing my code all night and cant seem to get it to work, so maybe you awesome devs can give me a pointer or two:

    this.controller.serviceRequest('palm://com.palm.display', {
    method:'status',
    parameters:{subscribe: true},
    onSuccess: (i need to launch an application based on whether the display 'state' returned from the 'status' method is on or off but dont know how)
    });
    I haven't done anything with this, but I would assume (based on what you said) that this should work:
    Code:
    onSuccess: function(returnValue, event, state, subscribed) {
       switch(state) {
          case "on":
             //code to go to one app
             break;
          case "off":
             //code to go to the other app
             break;
          case "dimmed":
             //code to go to somewhere else
             break;
       }
    }
    I found the info for that at developer.palm.com
    this.controller.serviceRequest('palm://com.palm.systemservice/time', {
    method:"getSystemTime",
    parameters:{subscribe: true},
    onSuccess: (i need to launch an app based on if the minutes returned from the 'getSystemTime' are less than 10)
    });
    Again, this is based off of what you say and what Palm's docs say. I do not have experience with this code.
    Code:
    onSuccess: function(localtime, offset, timezone, TZ, utc) {
       if (localtime.minute < 10) {
          //code to go to the app
       }
    }
    Based on what is available at developer.palm.com

    Also look at the Application Manager docs @ developer.palm.com
    Arthur Thornton

    Former webOS DevRel Engineer at Palm, HP, and LG
    Former webOS app developer (built Voice Memos, Sparrow, and several homebrew apps and patches)
    Former blogger for webOS Nation and webOS Roundup
  5.    #5  
    oh wow, thank you arthurthorton. The issue with the onSuccess function was even though the parameters were set up that way (localtime.minute < 10) i still need to include the "inResp" param to ensure that in response to the time being obtained it can be handled properly. at least thats what ended up fixing my issue. Im not a pro, but this definitely helped put somethings into persepective for me, thanks!

    completed code:

    onSuccess: function(inResp, localtime, offset, timezone, TZ, utc) {
    if (inResp.localtime.minute < 10) {
    //code to go to the app
    }
    }
    Last edited by srath16; 04/29/2010 at 07:41 PM.

Posting Permissions