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: 1,657
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

LBS LocationDocument problems with UTF-8

I already know, that a Location Document (<lbs>  ...  </lbs>) has problems with some characters:

 

& must be escaped as &amp;
< must be escaped as &lt;
' or " escaped as &apos; or &quot;

 understand this - is ok for XML

 

but there are problems with umlauts (per ex. üäö...) and I can imagine more....

 

I'm using UTF-8, so i tried to place at the beginning of the location document:

<?xml version="1.0" encoding="UTF-8"?>

 but it doesn't help if invoking the Map App:

MapsArguments mapsArgs = new MapsArguments(
	MapsArguments.ARG_LOCATION_DOCUMENT, "my-document-as-string");
try {
	Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);
} catch (IllegalArgumentException e) {
	// log
}

 

if there are locations inside the location document where umlauts are used, these locations are not displayed.

silently.

no exception.

 

took some time to see why this happened. my locations have addresses from (BlackBerry's service) reverse geocoding, where streets with umlauts are correctly used, but hindering the Map to display this from a Location document.

 

**QUESTION: any ideas how to solve this ? **

I need location documents because it's (as I know) the only way to get a Route.

 

using KML or Landmark[ ] umlauts are no problem - same locations are displayed well in Map App as KML or Landmark or in RichMapField as MapLocation.

 

my workaround: 

1. invoke map with location document to get the route, but start-coordinate and destination-coordinate are only named as 'START' and 'DESTINATION'

2. Invoke map with Landmark[ ] to display the start and location with rich details

 

this works, but using Landmarks another problem:

I don't know how to programatically delete Landmarks. I can clear locations inside lbs-documents, but I didn't found a way to delete Landmarks.

 

OK - I know, if leaving the Map APP and later coming back they are gone,

but I have the need...

- to stay at the Map APP

- shake the device

- my background app detects shake from Accelerometer

- clears existing points and displays next 109 min of a tracked path

 

but I couldn't delete the Landmarks from the background - new Landmarks are added

** QUESTION: How to delete Landmarks from Map APP - executed from background app while Map is inforeground **

 

BTW:
I made a VIDEO about this functionality well working from RichMapField where I'm displaying Waypoints of a tracked path. But if you want to compare the tracked path with calculated route this has to be done using the Map APP

 

...will blog in detail about GPS, LBS, Geolocation and more soon

 

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
BlackBerry Development Advisor
Posts: 15,211
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: LBS LocationDocument problems with UTF-8

By default, when a String object is created on a BlackBerry Smartphone it is created in the ISO-8859-1 format.  Since you are using UTF-8 characters, use a String construtor that allows you to specify the character encoding.  

 

The same code below would be creating the String in ISO-8859-1 format.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 1,657
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: LBS LocationDocument problems with UTF-8

thx....

 

but there are so many Strings: label, description, addresses etc

some of these String I got back from BlackBerry Reverse Geocoding -

works well with Landmark, MapLocation, but not inside LocationDocument

 

think it's easier to use LandMarks instead converting all Strings to UTF-8

- even if I cannot delete them from the Map App programmatically

 

do you think it's worth to enter an enhancement to support UTF-8 from lacation Document ?

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
BlackBerry Development Advisor
Posts: 15,211
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: LBS LocationDocument problems with UTF-8


ekke wrote:

 

do you think it's worth to enter an enhancement to support UTF-8 from location Document ?


Absolutely.  Please log this in Issue Tracker.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 1,657
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: LBS LocationDocument problems with UTF-8

added a feature request

 

https://www.blackberry.com/jira/browse/JAVAAPI-1936

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: LBS LocationDocument problems with UTF-8

Hi,

 

Can we get street name of the location using apis programatically?

 

Please let me know. Its urgent.

 

Thanks.

 

 

Regards,

Shubhangi

Developer
Posts: 1,657
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: LBS LocationDocument problems with UTF-8

you can get the address from your coordinates

take a look at the Locator

 

Landmark[] lma = Locator.reverseGeocode(yourCoordinate, searchType);

 from the Landmark you can get Address Info

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Highlighted
Developer
Posts: 97
Registered: ‎07-17-2008
My Device: Not Specified

Re: LBS LocationDocument problems with UTF-8

Thank you very much. Smiley Happy

 

 

I have one more doubt: If we display blackberry map on screen and click on the particular location can we get coordinate of the clicked location programmatically?

 

Thanks ain advance.

 

 

Regards,

Shubhangi