Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
ttklf4
Posts: 43
Registered: ‎07-29-2008
My Device: Not Specified

Re: Issues with JavaScript Location

Hello,

you have to enable JavaScript and JavaScript Location Support in the options menu.

Please use plain text.
New Developer
spackler
Posts: 4
Registered: ‎03-25-2009
My Device: Not Specified

Re: Issues with JavaScript Location

I just realized that I also had to enable GPS in the general device options in addition to the Browser options.

 

Thanks! 

Please use plain text.
Super Contributor
Meghasanghvi
Posts: 306
Registered: ‎08-10-2010
My Device: Not Specified

Re: Issues with JavaScript Location

hi

i implement the javaScript for latitude and long for the device

i always get you are in 0 lat and 0 longitude.

i tried this on many device but it always give 0,0 value

follwing is code snippet of my lat-lon find java script

code for script

 if( window.blackberry && blackberry.location.GPSSupported) {
        document.write("GPS Supported");
        blackberry.location.onLocationUpdate("locationCB()");
        blackberry.location.setAidMode(0);
        blackberry.location.refreshLocation();
 document.write("The client BlackBerry device is currently  located at Aid Mode 0 " + blackberry.location.latitude +
 " degrees latitude and " +
 blackberry.location.longitude +
 " degrees longitude.");
  }    
anyone have any idea about this please help me as soon as possible i needed urgently in my code
i tested this on Bold-9000,Bold-9700,Storm 9550
in option menu Advanced Options in the GPS -- Location On setting for GPS then also it give 0,0 lat-lon

 

Please use plain text.
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Device: Curve
My Carrier: Sprint

Re: Issues with JavaScript Location

Thanks for that last post.  I have a Blackberry curve ( App Version: 6.0.0.415 (1659)  ) and until reading that post I've been unsuccessful at getting location detection to work.  Everything that I've tried (except for your post) returns 0,0 for the latitude and longitude.  My goal is to get location detection working on every device that I can for my web app.  I seem to have it working fine on everything except for Blackberry.

 

One question I have is how do I remove the location handler?  This code is not working, as I never see the 'location handler removed' message.

 

<html>
<body>
<script language="Javascript">
function removeLocation() {
// dummy function since removeLocationUpdate requires a callback
window.alert("location handler removed");
}
function getLocation() {
window.alert("Your new position is " + blackberry.location.latitude + " degrees latitude and " + blackberry.location.longitude + " degrees longitude.");
blackberry.location.removeLocationUpdate(removeLocation);
}

if(blackberry.location.GPSSupported) {
blackberry.location.setAidMode(1);
blackberry.location.refreshLocation();
blackberry.location.onLocationUpdate(getLocation);
} else {
alert('nope');
}

</script>
<p>detecting location....</p>
</body>
</html>

 

 

By the way these exampls return 0,0 for the latitude and longitude:

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Using-HTML5-Geolocation-in-your-Web-or-...

 

http://code.google.com/p/geo-location-javascript/

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
jeffheifetz
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Issues with JavaScript Location

For developers using 5.0+ in a webworks app, or 6.0+ in a browser app you should simply be able to use HTML5 Geolocation



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Device: Curve
My Carrier: Sprint

Re: Issues with JavaScript Location

Please use plain text.