BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 12-04-2007, 06:04 PM   #21 (permalink)
New Member
 
Join Date: Dec 2007
Model: 8703e
PIN: N/A
Carrier: Sprint
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please Login to Remove!

Quote:
Originally Posted by camisa View Post
I too have a crippled Blackberry 7130e on Verizon Wireless.

Code:
<html>
<body>
<script language="Javascript">
<!--
if(blackberry.location.GPSSupported) {
blackberry.location.setAidMode(1);
blackberry.location.refreshLocation();
blackberry.location.onLocationUpdate(window.alert("Your new
position is " + blackberry.location.latitude +
" degrees latitude and " +
blackberry.location.longitude +
" degrees longitude."));
}
//-->
</script>
</body>
</html>
From a JavaScript perspective, your code is almost right, but there is a subtle error. This line is what is wrong:

blackberry.location.onLocationUpdate(window.alert( "Your new
position is " + blackberry.location.latitude +
" degrees latitude and " +
blackberry.location.longitude +
" degrees longitude."));

Passing a callback to another function should be in the form of function name only and not include the parenthesis. Parenthesis tell the function to execute immediately, which may be one of the reasons you're receiving the 0's.

You have to pass in a function, not execute the function.

Code:
function getLocation() {
    window.alert("Your new position is " + blackberry.location.latitude + " degrees latitude and " + blackberry.location.longitude + " degrees longitude.");
}
blackberry.location.onLocationUpdate(getLocation);
// you were doing: blackberry.location.onLocationUpdate(getLocation());
// which sends null to onLocationUpdate since getLocation doesn't return anything
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Hickok Model 370 Auto Polarity FET Multimeter Tube Tester
$59.99
Hickok Model 370 Auto Polarity FET Multimeter Tube Tester pictureHickok Model 370 Auto Polarity FET Multimeter Tube Tester
$59.99
Hickok Model 370 Auto Polarity FET Multimeter Tube Tester pictureampere meter 400A 75mV SV -4 STDlie amperes Ampere meter Dual Polarity
$20.25
ampere meter 400A 75mV SV -4 STDlie amperes Ampere meter Dual Polarity pictureMagnetic Pole Polar Magnet Pen Field Detector Polarity North General Tools Amy6
$24.67
Magnetic Pole Polar Magnet Pen Field Detector Polarity North General Tools Amy6 pictureDC Polarity Changer 5.5mm Centre Positive Socket to 2.1mm centre Negative Plug
$4.51
DC Polarity Changer 5.5mm Centre Positive Socket to 2.1mm centre Negative Plug picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.