Results 1 to 4 of 4
  1. ldj
    ldj is offline
    ldj's Avatar
    Posts
    256 Posts
    Global Posts
    264 Global Posts
       #1  
    In the services sample, there is no setup method defined:
    Code:
    function AppAssistant(appController) {
    }
    
    //This function will handle relaunching the app when an alarm goes off(see the device/alarm scene)
    AppAssistant.prototype.handleLaunch = function(params) {
    	//if params doesn't exist then it means a user is launching the app rather than an alarm
    	//causing it to launch and we should get out of here.
    	if (!params){
    		return;
    	}
    	
    	//this is the name we'll give to our popupAlert stage
    	var stageName = "alarm"		
    	//add the stage name to the params
    	params.stageName = stageName;
    
    	//get the proxy for the stage in the event it already exists
    	var alarmStage = this.controller.getStageProxy(stageName);
    	
    	//if the stage already exists then let it's current scene handle this relaunch (which
    	//we aren't actually doing anything for in our alarmAlert scene's code)
    	//otherwise create the new popupalert stage & push our alarmAlert scene + play a sound
    	if (alarmStage) {
    		alarmStage.delegateToSceneAssistant(stageName, params) 
    	} else {
    		var f = function(stageController) {
    			stageController.pushScene({name: "alarmAlert",
    					       		   	   sceneTemplate: "device/alarms/alarmAlert-scene"}, 
    								       params);
    		}
    		this.controller.createStageWithCallback({
    			name: 'alarm', 
    			lightweight: true,
    			name: stageName, 
    			"height": 160, 
    			sound: "/media/internal/ringtones/Rain Dance.mp3"
    		}, f, 'popupalert');		
    	}
    		
    };
    and it works fine. In my app, if I try to do the same, I get:
    2010-01-12T21:30:09.326882Z [2322] qemux86 user.warning LunaSysMgr: {LunaSysMgrJS}: co.uk.ldj.test: Warning: value was expected to be defined, but wasn't, file:///media/cryptofs/apps/usr/palm/applications/co.uk.ldj.test/index.html:0
    2010-01-12T21:30:09.329183Z [2322] qemux86 user.crit LunaSysMgr: {LunaSysMgrJS}: co.uk.ldj.test: Uncaught Error: requireDefined Failed: value was expected to be defined, but wasn't, palmInitFramework200_72:10202
    However, if I define a setup method it runs, but nothing happens:
    Code:
    AppAssistant.prototype.setup = function(params) {
    
    }
    
    AppAssistant.prototype.handleLaunch = function(params){
    ...
    }
    and if I call handleLaunch in setup, it runs as expected:
    Code:
    AppAssistant.prototype.setup = function(params) {
        this.handleLaunch();
    }
    
    AppAssistant.prototype.handleLaunch = function(params){
    However, when the alarm service is waking up the device and re-running my application, I am then hitting handleLaunch twice - once from the wakeup and once from the call in setup!!!

    It doesn't run without a setup method, yet when the alarm wakes it up I'm hitting both setup() and handleLaunch() which is causing problems!

    Can anyone advise what the hell is going wrong?

    Thanks
  2. ldj
    ldj is offline
    ldj's Avatar
    Posts
    256 Posts
    Global Posts
    264 Global Posts
       #2  
    Can anyone advise on this issue? I still cant figure it out
  3. #3  
    Is your app a noWindow app?
    Developer of:

    -------------------------------------
    Discuss my apps in my developer forum
  4. ldj
    ldj is offline
    ldj's Avatar
    Posts
    256 Posts
    Global Posts
    264 Global Posts
       #4  
    yep, it certainly is. I have defined "noWindow": true" in my appinfo.json

Tags for this Thread

Posting Permissions