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

Android™ Runtime Development

Reply
New Contributor
Posts: 7
Registered: ‎09-29-2010
My Device: Bold 9700
My Carrier: Developer and Founder

Get Lat&Lon Location from BB10 Device

Dear Friends,

 

I have a simple application and it works under android however i port it to BB10 it does not get Lat&Lon. 
There is no map it has only location listener. What is wrong?

 

I added also 2 permission:

<uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>

 

Source Code is below

 

Criteria criteria = new Criteria();

criteria.setAccuracy(Criteria.ACCURACY_COARSE);

criteria.setAltitudeRequired(false);

criteria.setPowerRequirement(Criteria.POWER_LOW);

 

String provider = locman.getBestProvider(criteria, true);

locman.requestLocationUpdates(provider, 5000, 0, listener);

 

LocationListener listener = new LocationListener() {

@Override

public void onLocationChanged(Location location) {

Double lat = location.getLatitude() * 1e6;

Double lon = location.getLongitude() * 1e6;

 

Log.e("lat lon", "" + lat + "  " + lon);

}

 

@Override

public void onStatusChanged(String provider, int status, Bundle extras) {

 

}

 

@Override

public void onProviderEnabled(String provider) {

 

}

 

@Override

public void onProviderDisabled(String provider) {

 

}

 

};

Developer
Posts: 34
Registered: ‎05-11-2012
My Device: Bold 9900
My Carrier: Vodacom

Re: Get Lat&Lon Location from BB10 Device

I'm also having problems with this exact same issue. Would really love to get a answer to this!

New Contributor
Posts: 7
Registered: ‎09-29-2010
My Device: Bold 9700
My Carrier: Developer and Founder

Re: Get Lat&Lon Location from BB10 Device

I tested device with its standard map application and foursquare results are same.

I have beta 10 device i guess that device does not recognize location