Results 1 to 6 of 6
  1.    #1  
    All,

    I am working on an app that analyze accelerometer raw data real time. However after few seconds of no activity (meaning no user gesture input) the screen turns off. Now whenever the screen turns off, the accelerometer raw data is stopped polling (no more raw data). Is there any api or methods that can collect the raw data even when the screen is turned off?

    Thanks
    M
  2. #2  
    You will want to look at the activityStart and activityEnd calls to the palm://com.palm.power/com/palm/power/ service. This allows your code to process while the screen is off.

    You are limited to 15 minutes, but could create two weaving calls if needed for longer. You might really kill battery life if you do that continuously, though.

    Here is some code I use in Word Whirl during the DB load. I'm using 900000 ms, or 15 minutes (the max allowed).

    Code:
    CreateDbAssistant.prototype.startActivity = function(){
    try{
    	this.activity = 'com.sachersoft.wordwhirl-1';
    	this.controller.serviceRequest("palm://com.palm.power/com/palm/power/", 
    		{
    			method: "activityStart",
    			parameters: {
    				id: this.activity,
    				duration_ms: '900000'
    			},
    			onSuccess: this.activitySuccess.bind(this),
    			onFailure: this.activityFailure.bind(this)
    		});	
    } catch(e) {
    	Mojo.Log.error("createDb.startActivity error: %j", e);
    }
    }
    CreateDbAssistant.prototype.stopActivity = function(){
    try{
    	this.controller.serviceRequest("palm://com.palm.power/com/palm/power/", 
    	{
    		method: "activityEnd",
    		parameters: {
    			id: this.activity
    		},
    		onSuccess: this.activitySuccess.bind(this),
    		onFailure: this.activityFailure.bind(this)
    	});	
    	this.activity = '';
    } catch(e) {
    	Mojo.Log.error("createDb.stopActivity error %j", e);
    }
    }
    Your Pre wants Word Whirl from the App Catalog.

    It told me.
  3.    #3  
    Hello sacherjj

    Thanks for your reply.

    I already set up the power service, so my app runs even after the screen goes off(all my log msg appears), however the accelerometer event stopped polling (i see no accelerometer data in the log) during this screen off. When i turn on the screen again, the raw data start logging again.

    Another question: If I call the power service, the screen suppose to be ON till the time we set in the power service? I set my screen time to 30 sec under screen and lock setting. And after this 30 second my screen automatically goes off even i set the power service for 2 min.

    Any other thoughts would be really appreciated

    Thanks
    M
  4. #4  
    No, the power service activityStart doesn't keep the screen on, it just keeps the OS from putting your code in a pause mode when it sleeps. Not sure about accelerometer data stopping.
    Your Pre wants Word Whirl from the App Catalog.

    It told me.
  5. #5  
    I can't seem to get it to work in my app. Have they changed something? Do I need to do anything else in any other file to get it to work? :/ I used your code and also tried the example on palm's web site, both are pretty much the same. I get this as an error though....
    typeError: cannot call method 'bind' of undefined

    What simple thing am I missing?
    Thanks fellow Hoosier!
  6. #6  
    Well I feel silly... I had a mental fart and thought activitySuccess was a member of the power management even though it said THIS.
    Opps how embarrassing, need an app to not let me post until I can think about things for a few more min.

Tags for this Thread

Posting Permissions