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

Java Development

Reply
Developer
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Location via Cell Tower rather then GPS

Hi all,

 

Im trying to locate the device by using the Cell tower solution rather then the gps as im only interested in the estimated location of the user.

 

try {

            Criteria criteria = new Criteria();

            criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);

            criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);

            criteria.setCostAllowed(true);

            criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);

            criteria.setAddressInfoRequired(false);

            criteria.setAltitudeRequired(false);

            criteria.setSpeedAndCourseRequired(false);

            

            locationProvider = LocationProvider.getInstance(criteria);

            

            if(locationProvider != null){

                System.out.println("LocationProvider");

                Location myLoc = locationProvider.getLocation(-1);

                

                lon = myLoc.getQualifiedCoordinates().getLongitude();

                lat = myLoc.getQualifiedCoordinates().getLatitude();

            }

}catch(Exception e){ System.out.println(e.toString()); }

 

The problem with the above code is that the locationProvider is always null.

 

I also tried to set the criteria only for power consumption and  cost allowed, but still no luck.

 

Im tried it on the simulator for the Bold 4.6 and i used a real device Bold running 4.6 with Vodafone, but still get the same issue...

 

Any help appreciated .... 

 

 

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Location via Cell Tower rather then GPS

you have to implement it yourself, the locationprovider can not work with celltower ids.
use the search power, there have been several similar questions. it all runs down to having a celltower id lookup table.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
New Developer
Posts: 17
Registered: ‎05-01-2009
My Device: Not Specified

Re: Location via Cell Tower rather then GPS

Some kind of location data is comming back through the SUPL response, but I haven't deciphered it yet.  I guess it's possible that the SUPL service doesn't return enough data to get a fix.

 

But, that doesn't explain why the Blackberry mapping application gets a quick first fix.  it's within 1200 meters, which is good enough for my first fix.