Results 1 to 2 of 2
  1.    #1  
    I setup a function in my app assistant that adds an alarm entry to the system calander. There is something that I'm calling incorrectly. When I run it in the emulator the app seriously breaks (I can't even minimize it!). When I run it on the Pre everything gets REALLY slow. On both, the alarm never gets set.

    Please take a look at my function and let me know what I'm doing wrong...

    Code:
    AppAssistant.prototype.setWakeup = function()
    {
        // GET CURRENT TIME IN MILLISECONDS
        // ADD TIME BASED ON UPDATE MODE
    
            var now = new Date();
    
            if (MoJack.mode == 'T') {var later = new Date(now + 350000);}
            else {var later = new Date(now + 1200000);}
    
        // FORMATE DATE
    
              var month = later.getUTCMonth() + 1;
                var day = later.getUTCDate();
               var year = later.getUTCFullYear();
               var hour = later.getUTCHours();
            var minutes = later.getUTCMinutes();
            var seconds = later.getUTCSeconds();
    
            if (month < 10) {month = '0' + month;}
            if (day < 10) {day = '0' + day;}
            if (hour < 10) {hour = '0' + hour;}
            if (minutes < 10) {minutes = '0' + minutes;}
            if (seconds < 10) {seconds = '0' + seconds;}
    
            var calendarEntry = '"' + month + '/' + day + '/' + year + ' ' + hour + ':' + minutes + ':' + seconds + '"';
    
        // SET NEXT WAKEUP ALARM
    
            alarmParameters =
            {
                "wakeup": true,
                   "key": "com.mojackllc.mojack.timer",
                   "uri": "palm://com.palm.applicationManager/launch",
                "params": '{"id": "com.mojackllc.mojack","params": {"action": "backgroundLocationUpdate"}}',
                    "at": calendarEntry
            };
    
            var alarmRequest = new Mojo.Service.Request('palm://com.palm.power/timeout', {method: "set", parameters: alarmParameters});
    }
    Just to clarify a couple of the variables...

    MoJack.mode -> Global variable that is set during initialization
    calendarEntry -> added quote marks because it REALLY broke when they weren't there. The example on Palm's Dev site using strict JSON like in the appinfo.json file (everything is quoted), so I did the same.
    Last edited by Laxidasical; 11/23/2009 at 07:28 PM.
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL
  2.    #2  
    Bump
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL

Posting Permissions