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

NBA DENVER NUGGETS waitress server waiter waist apron 3 pockets
$14.0
NBA DENVER NUGGETS waitress server waiter waist apron 3 pockets pictureToshiba MAGNIA SG20 PN:SYU3791W-00101 Server
$5.0
Toshiba MAGNIA SG20 PN:SYU3791W-00101 Server pictureUsed MOXA NPort N Port 6150 Secure Device Server Unit Open Box
$110.0
Used MOXA NPort N Port 6150 Secure Device Server Unit Open Box pictureGilbarco passport server px60
$1700.0
Gilbarco passport server px60 pictureSILEX PRICOM - HP Print Server - Internal H-260U
$15.95
SILEX PRICOM - HP Print Server - Internal H-260U  picture






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