Results 1 to 4 of 4
  1.    #1  
    okay so thanks to arthrthorton the other day, i was able to get plenty of work down on my app, however i hit one (hopefully final) roadblock. No worries its at the end, but i hope someone knows what to do, cause this one's got me stumped.

    First, i want to call a service, the display manager, then i want to exit the application based on the string returned from the 'state' param.

    Here's what i got:

    new Mojo.Service.Request('palm://com.palm.display', {
    method:'status',
    parameters:{},
    onSuccess: function(inResponse, returnValue, event, state, subscribed) {
    if (inResponse.state === "on") {
    this.controller.window.close();
    }});

    However, nothing happens. the scene pushes and just hangs...

    any advice? i also tried the plain "window.close()" instead of "this.controller.window.close()" but still nothing. an help is greatly appreciated
  2. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #2  
    Code:
    this.controller.window.close();
    That should work. But I would check your ) and } ....

    the very last parenthesis looks like there should be another squiggly bracket in front of it.

    also run
    Code:
    tail -f /var/log/messages
    from an ssh session while you are running your app. It may give you more information on what's occurring in the background and any errors that you're not seeing.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  3. #3  
    Also, the payload returned in a json parameter, not separate parameters.

    Personally, I'd recommend grabbing the request handle and storing it in variable, to prevent issues. The PalmDev team had similar issues, see here. And when storing the handle, don't forget to clear it when done with it.

    Lastly, you may want to bind the onSuccess function and maybe add an onFailure function.


    Like:
    Code:
    this.request = new Mojo.Service.Request('palm://com.palm.display', {
        method: 'status',
        parameters: {},
        onSuccess: function(response) {
            if (response.state === "on") {
                delete this.request;
                this.controller.window.close();
            }
        }.bind(this),
        onFailure: function(err) {
            delete this.request;
            Mojo.Controller.errorDialog(err.errorText);
        }.bind(this)
    });
    Last edited by Jason Robitaille; 05/01/2010 at 06:22 AM.
    If you've liked my software, please consider to towards future development.

    Developer of many apps such as: WebOS Quick Install, WebOS Theme Builder, Ipk Packager, Unified Diff Creator, Internalz Pro, ComicShelf HD, LED Torch, over 70 patches and more.

    @JayCanuck @CanuckCoding Facebook
  4.    #4  
    wow, awesome! that really put that in perspective for me, looks like everything checks out now thanks Jason and DrewPre

Posting Permissions