Skip to content

Commit

Permalink
accel and orientation are crashing ... documented in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Willoughby committed Dec 16, 2009
1 parent ef8811c commit fa9e0a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions symbian.wrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ The simulator requires Firefox and Firebug.

Your application should run inside Firefox, with the phonegap API functioning and returning test data for geolocation, contacts, acceleration, etc.

Notes
------------------------------------------------------
- Accelerometer and orientation are currently crashing. Appears to be a memory leak in the registerForNotification call, as discussed here: http://discussion.forum.nokia.com/forum/showthread.php?t=182151&highlight=memory+leak. There's not much to do about this until nokia fixes this, unless we find a workaround.

Helpful Links
-----------------------------------------------------
- PhoneGap API Docs: docs.phonegap.com
Expand Down
9 changes: 4 additions & 5 deletions symbian.wrt/js/accelerometer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error
// If the acceleration is not available then call error

try {

if (!this.serviceObj)
this.serviceObj = this.getServiceObj();

Expand All @@ -39,7 +38,6 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error
SearchCriterion: "AccelerometerAxis"
};
var returnvalue = this.serviceObj.ISensor.FindSensorChannel(SensorParams);

var error = returnvalue["ErrorCode"];
var errmsg = returnvalue["ErrorMessage"];
if (!(error == 0 || error == 1012)) {
Expand All @@ -64,13 +62,13 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error

this.success_callback = successCallback;
this.error_callback = errorCallback;

//create a closure to persist this instance of Accelerometer into the RegisterForNofication callback
var obj = this;

// TODO: this call crashes WRT, but there is no other way to read the accel sensor
// http://discussion.forum.nokia.com/forum/showthread.php?t=182151&highlight=memory+leak
this.serviceObj.ISensor.RegisterForNotification(criteria, function(transId, eventCode, result){
try {

var criteria = {
TransactionID: transId
};
Expand All @@ -88,8 +86,9 @@ Accelerometer.prototype.getCurrentAcceleration = function(successCallback, error
}

});

alert(4);
} catch (ex) {
alert(5);
errorCallback(ex);
}

Expand Down
2 changes: 2 additions & 0 deletions symbian.wrt/js/orientation.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Orientation.prototype.getCurrentOrientation = function(successCallback, errorCal
//create a closure to persist this instance of orientation object into the RegisterForNofication callback
var obj = this;

// TODO: this call crashes WRT, but there is no other way to read the orientation sensor
// http://discussion.forum.nokia.com/forum/showthread.php?t=182151&highlight=memory+leak
this.serviceObj.ISensor.RegisterForNotification(criteria, function(transId, eventCode, result){
var criteria = {
TransactionID: transId
Expand Down

0 comments on commit fa9e0a2

Please sign in to comment.