nkulkarni / geo-location-javascript

Automatically exported from code.google.com/p/geo-location-javascript
0 stars 1 forks source link

Does not work on BlackBerry Storm 2 & Bold 2. #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Attempt to access:  http://www.merkwelt.com/people/stan/geo_js/sample.html
2.  Pop-Up comes with null value on Storm 2.
3.  No pop-up on Bold 2.

What is the expected output? What do you see instead?
Should show Lat/Lng.  As a consolation - I tried a simple
Blackberry.location & received Lat/Lng of 0,0.
Checked Browser Settings & it appears that in 5.0 of Blackberry OS it comes
with Google Gears.  So - probably a conflict there.

What version of the product are you using? On what operating system?
Storm 2
Verizon
Version:  5.0.0.320

Bold 2
AT&T
Version:  5.0.0.321

Original issue reported on code.google.com by darrenf...@gmail.com on 8 Dec 2009 at 10:57

GoogleCodeExporter commented 9 years ago
Question: In the Browser Options/General Properties is there "Enable JavaScript
Location support" turned on?

Original comment by whoiss...@gmail.com on 9 Dec 2009 at 6:24

GoogleCodeExporter commented 9 years ago
Yes these settings are enabled on the Storm 2.  I coded a simple page for the 
Storm 2
& this works:
<html>
<head>
<meta name = "viewport" content = "initial-scale = 1.0">
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
</head>
<script type="text/javascript">
var gps = blackberry.location.GPSSupported;
        // set to Assisted mode
        blackberry.location.setAidMode(1);
        blackberry.location.refreshLocation();
        alert("Lat/Lng:  " + blackberry.location.latitude + " " +
blackberry.location.longitude);
</script>
</html>

Original comment by darrenf...@gmail.com on 9 Dec 2009 at 7:01

GoogleCodeExporter commented 9 years ago
I took the quotes off the function call on line 70 in the geo.js file and that 
seems
to have done the trick:

line 70 replace                        
blackberry.location.onLocationUpdate("handleBlackBerryLocation()");
with                       
blackberry.location.onLocationUpdate(handleBlackBerryLocation());

Kevin Dubois

Original comment by kevin.du...@gmail.com on 10 Dec 2009 at 12:44

GoogleCodeExporter commented 9 years ago
according to 

http://www.tonybunce.com/2008/05/08/Blackberry-Browser-Amp-GPS.aspx

the callback should be passed as a string rather then a method call. do you have
older bb devices to confirm that this is not correct.

otherwise we can make it conditional, if a certain user agent is given don't use
string but the function. a bit messy but we might have to go that route. what 
do you
think?

Original comment by whoiss...@gmail.com on 11 Dec 2009 at 2:20

GoogleCodeExporter commented 9 years ago

Original comment by whoiss...@gmail.com on 11 Dec 2009 at 3:01

GoogleCodeExporter commented 9 years ago
I made this change & tried it on 4.5 & 4.7.  No go.  I do not get the Java 
pop-up.  

blackberry.location.onLocationUpdate("handleBlackBerryLocation()");
with                       
blackberry.location.onLocationUpdate(handleBlackBerryLocation());

-Darren

Original comment by darrenf...@gmail.com on 11 Dec 2009 at 2:36

GoogleCodeExporter commented 9 years ago
According to the blackberry documentation:
"Method: blackberry.location.onLocationUpdate()
The onLocationUpdate() method registers a listener that evaluates a string or 
calls a
function whenever the BlackBerry® device receives updated location information.
On BlackBerry devices running versions of BlackBerry® Device Software earlier 
than
version 4.6, this method must be passed as a string that is evaluated each time 
the
location is refreshed. On BlackBerry devices running BlackBerry Device Software
version 4.6 or later, you can pass a string, or use the method to register a 
callback
function."

So I added a condition the lib, that either uses a string or the method name. 
Could
you verify that for me?

Sample is here:
http://www.merkwelt.com/people/stan/geo_js/sample.html

I think this will do;)

Original comment by whoiss...@gmail.com on 17 Dec 2009 at 8:39

GoogleCodeExporter commented 9 years ago
I'm having the same problem with a storm version 1 verizon  v 5.0.0.328

http://www.merkwelt.com/people/stan/geo_js/sample.html <= I get error=null in 
the alert box

http://www.saefern.org/tickets/test_bb_gps.php  <= this link will map it 
correctly  

I think that the difference is that on the geo.js google gears is activated 
first 

if I change line 58 

 if (typeof(window.google) != "undefined") to

if (typeof(window.google) != "undefined"  && typeof(window.blackberry) == 
"undefined")

it works fine... I'm not sure if thats how you want to handle this exception.  

you can check it out here 

http://stephenquick.com/geo/

Original comment by stephen....@gmail.com on 31 Dec 2009 at 6:51

GoogleCodeExporter commented 9 years ago
hey, i think they bberry issues were two different ones. i changed the sample 
on my
site to do blackberry before google gears:

http://www.merkwelt.com/people/stan/

does that work now for you? i only have a bberry 8900 and don't have any 
problems
running the samples at all. 

please let me know,
stan

Original comment by whoiss...@gmail.com on 2 Jan 2010 at 11:02

GoogleCodeExporter commented 9 years ago
The new version you linked to works correctly on my  storm version 1 verizon  v 
5.0.0.328

Original comment by stephen....@gmail.com on 4 Jan 2010 at 4:12

GoogleCodeExporter commented 9 years ago
very good thanks, i will post it on a blackberry web developer newsgroup have 
them
take a look at it as well.

Original comment by whoiss...@gmail.com on 4 Jan 2010 at 8:02

GoogleCodeExporter commented 9 years ago
There appears to be one error I've encountered, specifically regarding:

===
if(parseFloat(navigator.appVersion)>=4.6) 
{ 
   blackberry.location.onLocationUpdate(handleBlackBerryLocation()); 
} 
===

What this actually does is immediately call handleBlackBerryLocation(), and 
therefore ends all processing of the script.  I found this because of a timing 
issue, frequently I'd get lon=0,lat=0.

Instead, the call should simply be function name only, no following parentheses.

===
if(parseFloat(navigator.appVersion)>=4.6) 
{ 
   blackberry.location.onLocationUpdate(handleBlackBerryLocation); 
} 
===

This change also agrees with this in that it says processing will end upon 
enounter 
of handleBlackBerryLocation():

http://www.tonybunce.com/2008/05/08/Blackberry-Browser-Amp-GPS.aspx

Thanks for a great script!!!

Original comment by cont...@lifeoutsystems.com on 29 Jan 2010 at 2:16

GoogleCodeExporter commented 9 years ago
One more change I noticed.  The call to:

blackberry.location.removeLocationUpdate();

Is incorrect.  It should include the callback name in it as well:

blackberry.location.removeLocationUpdate(handleBlackBerryLocation);

This is in accordance with the documentation:

http://docs.blackberry.com/en/developers/deliverables/11849/blackberry_location_
remov
eLocationUpdate_568409_11.jsp

Again, thanks much!!!

Original comment by cont...@lifeoutsystems.com on 29 Jan 2010 at 2:34

GoogleCodeExporter commented 9 years ago
First of all thanks very much for your debugging and problem solving. I have a
Blackberry Bold and somehow managed to seriously mess up my device recently, so 
I
can't confirm my recent changes. 

So I changed the callback definition, removed brackets:
                        if(parseFloat(navigator.appVersion)>=4.6)
{           blackberry.location.onLocationUpdate(handleBlackBerryLocation);
}

And the callback removal by adding the method:
blackberry.location.removeLocationUpdate(handleBlackBerryLocation);

Could you confirm that my sample is working before I make a new release?
http://www.merkwelt.com/people/stan/geo_js/sample.html

Thanks very much!

Original comment by whoiss...@gmail.com on 3 Feb 2010 at 2:16

GoogleCodeExporter commented 9 years ago
Yes, the sample works perfectly on my BB Tour (4.7).

Thanks for your help!

Original comment by cont...@lifeoutsystems.com on 3 Feb 2010 at 5:52

GoogleCodeExporter commented 9 years ago
great!

Original comment by whoiss...@gmail.com on 3 Feb 2010 at 5:57

GoogleCodeExporter commented 9 years ago
The sample did not work on a Blackberry storm 9520. I get asked by gears to 
allow
access and then get an error = null notice.

Original comment by Kim.Gri...@gmail.com on 26 Apr 2010 at 1:57

GoogleCodeExporter commented 9 years ago
I think I know what it is, but I currently don't have such a device anymore. 
Can I work with you to resolve that? I 
would prepare a couple of versions to investigate the problem. Let me know!

Original comment by whoiss...@gmail.com on 27 Apr 2010 at 1:25

GoogleCodeExporter commented 9 years ago
I have a Storm 2 and am also getting "error = null".

Please let me know if I can test something.

Original comment by goldman....@gmail.com on 3 Jun 2010 at 9:33

GoogleCodeExporter commented 9 years ago
yes you can help. 

when you go here:
http://www.merkwelt.com/people/stan/geo_js/sample.html

Is it a google gears dialog you are seeing? I need to know if its using google 
gears or blackberry browser 
technology.

Thank you!

Original comment by whoiss...@gmail.com on 3 Jun 2010 at 9:46

GoogleCodeExporter commented 9 years ago

 http://www.merkwelt.com/people/stan/geo_js/sample.html

on a 9550 getting a null error 

Original comment by jdgern...@gmail.com on 5 Jun 2010 at 4:20

GoogleCodeExporter commented 9 years ago
 sorry should have said...shows gears allow first then returns null popup. 

http://www.merkwelt.com/people/stan/geo_js/sample.html

phone is 9550 on verizon network

Interestingly, a 9530 verizon simulator works fine and returns the correct lat 
and long. 

Original comment by jdgern...@gmail.com on 5 Jun 2010 at 4:22

GoogleCodeExporter commented 9 years ago
hey,
so i just heard the same thing from a different user on a 9550. maybe gears is 
just not working on the 9550. so you are saying you getting a null popup, does 
that mean that you see "error=null"? or just "null", because if its just null i 
would have idea what should trigger that. since the error handler for the page 
is:

        function error_callback(p)
        {
            alert('error='+p.message);
        }

i changed that to

        function error_callback(p)
        {
            alert('error='+p.code);
        }

since the error object could be potentially empty, the error code should always 
be there, i am just afraid that it won't help much. can you tell me if you at 
least an error code?

thank you,
stan

Original comment by whoiss...@gmail.com on 9 Jun 2010 at 12:15

GoogleCodeExporter commented 9 years ago
Hey, I've been testing the geo-location javascript on several phones with mixed 
result.  Android, Palm and iPhone work great.  Blackberry is very 
disappointing.  We tried on several Blackberry models and none of them worked.  

Stan, we also went to your site with the same results as mentioned above.  Here 
are the models we tested:

Storm 9700 OS 5.0.0.602 - No error, no lat/long... nothing.  Like it dies with 
a javascript error or something

Bold 9000 OS 4.6.0.304 - Error code = 2.  No lat/long.

We're updating to OS 5 on our Bold and will post you the results after that.

To me, this is a high priority defect since it doesn't seem to work on any of 
the newer blackberries.  Blackberry is our highest user base for the project 
I'm working on.

Thanks.

Cary

Original comment by marrgr...@gmail.com on 30 Aug 2010 at 2:47

GoogleCodeExporter commented 9 years ago
hey there, 

i just tested
http://www.merkwelt.com/people/stan/geo_js/sample.html
on my blackberry 8900, OS 4.6 and it worked perfectly.

can you tell from pop that requests the permission to get the location if its 
google gears or not.

stan

Original comment by whoiss...@gmail.com on 30 Aug 2010 at 3:01

GoogleCodeExporter commented 9 years ago
Yes, both are using google gears.

We updated the Bold 9000 to OS 5.0.0.822 and it now works.  Is there a solution 
to the gears issue?  I doubt we're going to get all of our users to update 
their OS.

Cary

Original comment by marrgr...@gmail.com on 30 Aug 2010 at 7:01

GoogleCodeExporter commented 9 years ago
google gears is a problem on blackberry. It quite often does simply not return 
anything usable which is a shame. What I recommend in your case to remove the 
google gears handling altogether from the library until there is a solution. It 
will then fallback to the basic blackberry location which works on pretty much 
all of the bb out there. 

Simply remove:
else if(typeof(window.google)!="undefined" && typeof(google.gears)!="undefined")
 {
provider=google.gears.factory.create('beta.geolocation');
}

from geo.js. Maybe since that is beneficial for you are willing to look more 
into issue with blackberry and google gears. I am open to any help in that 
area. 

Original comment by whoiss...@gmail.com on 7 Sep 2010 at 3:49

GoogleCodeExporter commented 9 years ago
Can we move the following lines the last i.e after blackberry?
else if(typeof(window.google)!="undefined" && typeof(google.gears)!="undefined")
 {
provider=google.gears.factory.create('beta.geolocation');
}

Will it solve the problem?

Original comment by rajnish....@gmail.com on 9 Sep 2010 at 3:34

GoogleCodeExporter commented 9 years ago
Or can we use the following -

else if(typeof(window.google)!="undefined" && typeof(google.gears)!="undefined" 
&& 
navigator.userAgent.indexOf("BlackBerry")<=0)
{
    provider=google.gears.factory.create('beta.geolocation');
}

Original comment by rajnish....@gmail.com on 9 Sep 2010 at 5:38

GoogleCodeExporter commented 9 years ago
both solutions work. i prefer to simply move the gears detection below the 
blackberry detection.

@marrgroup: can you give that a try? attached a file that reflects the change.

Original comment by whoiss...@gmail.com on 9 Sep 2010 at 7:26

Attachments:

GoogleCodeExporter commented 9 years ago
Stan,

Thanks, that did indeed fix our issue.  I tested on all the current models that 
we were having issues with as well as the models that worked.  

I agree that it would be better to move the gears below blackberry detection.  
This change would probably solve the original poster's issue as well since we 
were having issues on both the storm and the bold.

Cary

Original comment by marrgr...@gmail.com on 10 Sep 2010 at 6:34

GoogleCodeExporter commented 9 years ago
I have a BB App Version: 6.0.0.415 (1659).  I believe it is a Curve.  The 
latitude and longitude is always returned as 0, 0 with this device.  I've tried 
using the geo.js attached on Sep 9, 2010.  I've also tried this link:
http://www.merkwelt.com/people/stan/geo_js/sample.html

Can anyone offer any suggestions?  Thanks.

Original comment by robwolfb...@gmail.com on 17 Dec 2011 at 2:31

GoogleCodeExporter commented 9 years ago
The code below is the only example that I've found to actually detect my 
location on my blackberry. Since this code works, it looks like the 
'geo-location-javascript' has a bug.

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

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>

Can anyone help?  This is a major issue for me.  Location detection works fine 
on every device that I've tested accept for blackberry.  (note: 
'alert("location handler removed")' never fires so there does appear to be a 
bug associated with removing the handler.)

Original comment by robwolfb...@gmail.com on 18 Dec 2011 at 2:07

GoogleCodeExporter commented 9 years ago
Interesting. I do not own a BB anymore myself. Would you care to join the 
project and update the file? I actually thought the with OS6 you can go through 
regular W3C compliant geo location and not use BB's own. Can you find out if it 
goes into this condition on your device:

92:else if (typeof(navigator.geolocation)!=u)

thanks!

Original comment by whoiss...@gmail.com on 19 Dec 2011 at 3:18