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

Vintage 1/2" Drive MAC VUI 166T 6 Point Impact Swivel Socket
$11.95
Vintage 1/2LARGE STEEL GREASE CUP OLD ANTIQUE VINTAGE GAS STEAM TRACTOR HIT MISS ENGINE MAC
$7.99
LARGE STEEL GREASE CUP OLD ANTIQUE VINTAGE GAS STEAM TRACTOR HIT MISS ENGINE MAC pictureVintage Mac Tools Offset Slotted Screwdriver OD2 USA
$22.5
Vintage Mac Tools Offset Slotted Screwdriver OD2 USA pictureVintage Mac Tools ET-390 Electrical Systems Analyzer - Good Working Condition -
$39.99
Vintage Mac Tools ET-390 Electrical Systems Analyzer - Good Working Condition -  pictureSMALL STEEL GREASE CUP OLD ANTIQUE VINTAGE GAS STEAM TRACTOR HIT MISS ENGINE MAC
$9.99
SMALL STEEL GREASE CUP OLD ANTIQUE VINTAGE GAS STEAM TRACTOR HIT MISS ENGINE MAC picture






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