Display.getInstance().getLocationManager().getCurrentLocation() Doesn't Work Indoors in BB

86 views
Skip to first unread message

ayoola ajebeku

unread,
Sep 16, 2013, 2:55:45 PM9/16/13
to codenameone...@googlegroups.com
Hello,

Display.getInstance().getLocationManager().getCurrentLocation() for getting position doesn't work indoors in blackberry devices - OS 5.
It keeps loading for a long time, but doesn't get the user location; though the blackberry internet service is on.




ayoola ajebeku

unread,
Sep 16, 2013, 3:58:58 PM9/16/13
to codenameone...@googlegroups.com
Also,

Trying to use native code, I imported 

import net.rim.device.api.gps.BlackBerryCriteria;


but sending the build to the server keeps giving me error. Says cannot find symbol.

Chen Fishbein

unread,
Sep 16, 2013, 4:32:13 PM9/16/13
to codenameone...@googlegroups.com
it probably fails on the 4.2 build add this build hint rim.ignor_legacy=true to build only the OS 5 version.

ayoola ajebeku

unread,
Sep 17, 2013, 2:11:28 PM9/17/13
to codenameone...@googlegroups.com
Thanks it's working now.

I've not been able to find the code used for the implementation of getCurrentLocation for Blackberry.

I saw this code on Stackoverflow and it worked for me, maybe it could be added to it to make it work better.


private BlackBerryCriteria blackBerryCriteria = null;
private BlackBerryLocation blackBerryLocation = null;
private BlackBerryLocationProvider blackBerryLocationProvider = null;
double lat = 0.0;
double lng = 0.0;

blackBerryCriteria = new BlackBerryCriteria();

    if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_CELLSITE)) 
    {
        blackBerryCriteria.setMode(GPSInfo.GPS_MODE_CELLSITE);
    }
    else if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_ASSIST)) 
    {
        blackBerryCriteria.setMode(GPSInfo.GPS_MODE_ASSIST);
    }
    else if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)) 
    {
        blackBerryCriteria.setMode(GPSInfo.GPS_MODE_AUTONOMOUS);
    }
    else 
    {
        blackBerryCriteria.setCostAllowed(true);
        blackBerryCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
    }

try {
            blackBerryLocationProvider = (BlackBerryLocationProvider) BlackBerryLocationProvider.getInstance(blackBerryCriteria);
            blackBerryLocation = (BlackBerryLocation) blackBerryLocationProvider.getLocation(60);

            QualifiedCoordinates qualifiedCoordinates = blackBerryLocation.getQualifiedCoordinates();

            lat = qualifiedCoordinates.getLatitude();
            lng = qualifiedCoordinates.getLongitude();}catch(Exception e)
        {
            System.out.println("Error in location :"+e.toString());
            System.out.println("Error in location :"+e.getMessage());
        }

Gareth Murfin

unread,
Feb 25, 2014, 10:24:35 PM2/25/14
to codenameone...@googlegroups.com
I believe this is still an issue on bold 9900 when i get gps and say ok it just hangs for a LONG time, usually forever, sometimes not forever. I will try this code, but then surely that will make the android ones etc not build. 

Gareth Murfin

unread,
Feb 25, 2014, 11:02:47 PM2/25/14
to codenameone...@googlegroups.com
Just realised if I get up and walk around and go into the garden etc it works, so it seems BB is just very bad at getting a location without a view of the sky? A limitation of the device/OS I presume, seems crazy given how well android/ios work indoors.


--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/ypUVJihwWL8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/84c2c454-fbb2-466a-b490-de7d1ecbe279%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Gareth Murfin
(Android Freelancer - www.garethmurfin.co.uk)

Gareth Murfin

unread,
Feb 25, 2014, 11:18:36 PM2/25/14
to codenameone...@googlegroups.com
So is there a way to get the blackberry specific code above used in a CN1 app? I have just remembered BB was always very bad without some extra help, but how can we put that extra help in if it is blackberry specific and wont compile in NB? No support for preprocessors either?

I remember it all begins working nicely if you can set the modes like Ayoola pointed out, but yeh how do we use platform specific code?

Gareth Murfin

unread,
Feb 25, 2014, 11:36:56 PM2/25/14
to codenameone...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages