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

Native Development

Reply
Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Geolocation Example & html_message

With respect to the Geolocation Example I have a few questions:

 

 

dialog_set_html_title_text(main_dialog, "<h1 style=\"color:blue\"><b>Geolocation Example</b></h1>");

 

seems to work okay except colour isn't changed, it remains black but the bold works.  

What are the html limitations in dialogs?

 

dialog_set_alert_message_text(main_dialog, "Geolocation getting first fix");

 

 Works fine with results printing each second regardless the validity of the geo information.

 

However,

dialog_set_alert_html_message_text(main_dialog,"<h1><b>GPS Logger getting first fix ...</b></h1>");  

 

seems to print okay but it appears to hang since no geo information is printed afterwards.

 

Is this a bug?

 

Roger

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Geolocation Example & html_message

It sounds like you're trying to troubleshoot a problem with two entirely unrelated parts of the system. I'd suggest decoupling the two and verifying that what you're seeing is related solely to the GPS and not to the dialogs, or vice versa.

You could, for example, just use printf("stuff") to send output to the log file, and review that afterwards, to see whether what you're expecting to get from the GPS is correct. Then you'd know the issue involves only the dialog.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Re: Geolocation Example & html_message

Hi Peter,

 

Thank you for your quick reply.

 

I am fairly confident the problem is related to the dialog.  If I print to dialog without using ...html_text there is no problem if I print to dialog using ...html_text then the application appears to hang.

 

The dialog works and geolocation_info works but not when I use message_html_text when geolocation_info hangs.  Interestingly, using title_html_text poses no such problem.

 

 

Roger

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Geolocation Example & html_message

Can you demonstrate it with a small bit of code involving a timer instead of the geolocation stuff? The issue could then more easily be reproduced by others, and/or you could attach the code to a problem report that you file in the Jira issue tracker.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Re: Geolocation Example & html_message

Sure, I think I can do that for tomorrow.

Highlighted
Developer
Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Re: Geolocation Example & html_message

This may not be exactly what you wanted but I think it clearly shows the problem.  I am using the example GeolocationSampleManaged.

 

Around line 203 in main.c I have these two lines:

 

Case #1: This works.

dialog_set_alert_message_text(main_dialog, "Geolocation getting first fix");
// dialog_set_alert_html_message_text(main_dialog,"<b>Geolocation getting first fix ...</b>");

 

Case #2 This doesn't work.

// dialog_set_alert_message_text(main_dialog, "Geolocation getting first fix");
dialog_set_alert_html_message_text(main_dialog,"<b>Geolocation getting first fix ...</b>");

 

Around line 423 I modified as follows:

 

char buf[200];

snprintf(buf,sizeof buf, "Count: %u\n",++count);
if (bps_event_get_domain(event) == geolocation_get_domain())
{
// handle_geolocation_response(event);
dialog_set_alert_message_text(main_dialog, buf);  // Only works for Case #1 above
dialog_update(main_dialog);
fprintf(stderr,"Count: %u Event: %d \n",count,bps_event_get_domain(event));  // This works in both cases

 

It is interesting to note the following does work for both cases above.

 

// snprintf(buf,sizeof buf, "Count: %u\n",++count);
snprintf(buf,sizeof buf, "<b><i>Count: %u</i></b>\n",++count);
if (bps_event_get_domain(event) == geolocation_get_domain())
{
// handle_geolocation_response(event);
// dialog_set_alert_message_text(main_dialog, buf);
dialog_set_alert_html_message_text(main_dialog, buf);
dialog_update(main_dialog);
fprintf(stderr,"Count: %u Event: %d \n",count,bps_event_get_domain(event));

 

It may be that once the dialog message has been used with html it doesn't process plain text afterwards?

 

Would you please tell me what html commands are allowed?  I tried tables but they don't seem to work and neither does  font and colour attributes.

 

Hope this helps,

  Roger