Using Places API (Part II: the Coding)

After designing the application and collecting all the
components, it was time to code. But with the coding came the first
difficulties. The very first being a bug in the platform services 2.0. The
application would instantly crash when using both Platform Services and Places
API together.

There are two ways to avoid this:

Short
way:  just include the platform services
library before you include the Places API library. Like this:

 

      <script type="text/javascript" src="script/platformservices.js" charset="utf-8" ></script>

      <script
type="text/javascript"
src="http://api.maps.ovi.com/places/alpha3/jsPlacesAPI-en_GB.js"></script>

 

Longer way (better): you will correct the bug in the library. Look for
the initialitzation of the nokia.device object at the beginning of the library.

 

Replace this line:  if((typeof nokia.device)!="undefined")

For
this other line: if((typeof nokia.device)=="undefined")

After either one of those options, the library should work correctly.

For the Meeting Point application, I just needed the
Searchbox template (to search for a place), the placeList template (to display
the results) and the Place template (display the chosen meeting place)
My first idea was to use the default Places API templates, but when I displayed
them on the mobile phone they didn’t look nice and lots of elements were not in
the appropriate size.

Luckily I had one coworker developing some Places API
templates for mobile phones, so I took his work for my application :P (you can
see the code below)

For the searchbox and the placelist the default mobile
template was perfect for me.  Below there
are the template definitions, and the UI widgets declarations.

          PLACELIST
TEMPLATE

       
<div module="List">

            <ul each="{results[].place}"
rel="list-data" class="nokia-place-list">

                <li class="nokia-place-list-elem"
rel="nokia-place-item">

                    <img url="{categories[0].iconURL}"
class="nokia-place-category">

                    <div class="nokia-place-list-elem-content">

                        <p fill="{name}"
rel="nokia-place-name" class="nokia-place-name"></p>

                        <div class="nokia-place-address">

                            <span fill="{street()}"></span>, <span fill="{locality()}"></span>

                        </div>

                        <div tpl="nokia.general.rating"
if={placeId} class="nokia-places-mobile-rating-widget"></div>

                    </div>

                </li>

            </ul>

            <div rel="list-pagination"></div>

        </div>

           SEARCHBOX
TEMPLATE

       
<div module="SearchBox"
class="nokia-searchbox">

            <div class="nokia-searchbox-input-wrapper"
>

                <input class="nokia-searchbox-input"
type="text" rel="searchbox-input"/>

            </div>

            <input class="nokia-searchbox-button"
type="button" rel="searchbox-button"
value="Search"/>

            <div rel="searchbox-list"
class="nokia-searchbox-list">

            </div>

        </div>

Here you can find the
css file for the templates: ovi-places-mobileHTML5.css

 

 

        var placeList
= new
nokia.places.PlaceList({

               targetNode: ‘placeListContainer’,

               template: ‘nokia.mobileHTML5.placelist’,

               perPage: 100,

               locale: ‘en-gb’,

              
events:
[ {

                   rel: 'nokia-place-item',

                   name: 'click',

                   handler: function(jsonObject){

                       if
(jsonObject.placeId) {

                           place.setPlaceId(jsonObject.placeId);                               

                       }else{

                           place.setData(jsonObject);

                       }               

                       pageController("selectPlace");

                                 

                   }

               }]

           })

           var
onResults =
function(data){

                            placeList.setData(data);

                     searchType = "placelist";

                     showSearchPlace();

           }

 

         var
sb = new nokia.places.SearchBox({

               targetNode: ‘searchContainer’,

               template: ‘nokia.mobileHTML5.searchbox’,

               locale: ‘en-gb’,

               suggestions: {

                   showAddress: true

               },

               searchCenter: function
() {

                   return
position;

               },

               onResults: onResults

           });

As you can see the mobile templates are pretty much the same
as the “normal” templates, it’s the css that has the major changes.
Note also, that to use the mobile templates, I declare the UI Widgets in the
standard way, and the only thing that I need to change is the template
parameter.

I also wanted my application to erase the text on the
SearchBox when on the search page and the back button is pressed.
To achieve this small change you need the following piece of code:

 

function previousPageKey()
{
       if (actual == "searchPlace") document.getElementsByClassName(‘nokia-searchbox-input’)[0].value = "";   

}

 

function init(){            

window.menu.setRightSoftkeyLabel(‘Back’,
previousPageKey);

}

-       To change the behavior of the Back key in
Symbian you need to use this line of code:

window.menu.setRightSoftkeyLabel(‘Back’, previousPageKey);

As you also have to define the function
that will be triggered when the Back key is pressed.
more info

-      To know how to select the input field in the
searchBox. The quickest way is to use firefox + firebug and explore the html
content or use the html explorer of the simulator.

The
next step was to adapt the mobile place template, because I needed it to do
some specific things for my application. To be precise I wanted to add a button
for creating a meeting in the selected place.

You
can see the code for my mobile place template here:

<script id="mobilePlaceWidget"
type="text/template">  

<div tpl="nokia.mobileHTML5.map"
class="nokia-place-right"></div>

<div tpl="nokia.mobileHTML5.name" class="nokia-place-header"></div>

 

 

<div class="nokia-place-header
nokia-places-mobileHTML5-menu"
>

       <div class="nokia-place-menu">

              <ul>

                     <li class="nokia-place-menu-element
nokia-place-menu-phone"
>

                           <a url="{primaryPhoneCall()}">Call</a>

                     </li>

                     <li class="nokia-place-menu-element
nokia-place-menu-share"
>

                           <a url="{primaryPhoneSMS()}">Share</a>

                     </li>

                     <li onclick="pageController(‘selectFriends’);" class="nokia-place-menu-element
nokia-place-menu-route"
>

                           <a>Meet</a>

                     </li>

                     <li class="nokia-place-menu-element
nokia-place-menu-web"
>

                           <a url="{primaryURL()}">Web</a>

                     </li>

              </ul>

       </div>

</div>

 

     

<div tpl="nokia.mobileHTML5.gallery" class="nokia-place-header"></div>

 

<div if="{businessInformation.openingHours}">

    <p c

Nokia’s developer offering refreshed

I’m sure you have seen the news already, and they are indeed big. To begin with, individuals can now be Ovi Store publishers. It will still cost you 50€ to register but once you’ve done that there are no more costs for you, Nokia will take care of all the signing costs for you. I’m sure many individual developers, students and hobbyists are getting now the answer they’ve been waiting for. Yes, developing for Symbian is possible and profitable for you as well.

But that’s not all. To sell good applications you need good development tools, and the final release of the Nokia Qt SDK 1.0 is just that. One tool, one application and UI framework, one source code and capability to build apps for both Maemo 5 and Symbian/S60 (starting with S60 3.1).

 

Nokia Qt SDK Final

 

 

The SDK includes the final release of the Nokia Smart Installer for Symbian, a tool designed to ease the distribution of Qt based applications to devices which do not have yet Qt libraries built-in. See below the installer in action.

 

 

Speaking of the Smart Installer, there is something you should know :)

The SDK was packaged with a slightly older version of the Smart Installer, so if you are using the offline installer you should make sure to query for SDK updates using the maintenance tool from SDK’s application group in Windows’ Start menu. By doing so you will be able to fetch the up-to-date version of the Nokia Smart Installer for Symbian.

 

Smart Installer Update

If you have used the online installer for the SDK then you already have the latest smart installer build, no need for an update check yet.

And that’s the end of my status report in this post. I’d like to hear what you think of these news, either here or on Twitter.

 

Nokia’s developer offering refreshed

I’m sure you have seen the news already, and they are indeed big. To begin with, individuals can now be Ovi Store publishers. It will still cost you 50€ to register but once you’ve done that there are no more costs for you, Nokia will take care of all the signing costs for you. I’m sure many individual developers, students and hobbyists are getting now the answer they’ve been waiting for. Yes, developing for Symbian is possible and profitable for you as well.

But that’s not all. To sell good applications you need good development tools, and the final release of the Nokia Qt SDK 1.0 is just that. One tool, one application and UI framework, one source code and capability to build apps for both Maemo 5 and Symbian/S60 (starting with S60 3.1).

 

Nokia Qt SDK Final

 

 

The SDK includes the final release of the Nokia Smart Installer for Symbian, a tool designed to ease the distribution of Qt based applications to devices which do not have yet Qt libraries built-in. See below the installer in action.

 

 

Speaking of the Smart Installer, there is something you should know :)

The SDK was packaged with a slightly older version of the Smart Installer, so if you are using the offline installer you should make sure to query for SDK updates using the maintenance tool from SDK’s application group in Windows’ Start menu. By doing so you will be able to fetch the up-to-date version of the Nokia Smart Installer for Symbian.

 

Smart Installer Update

If you have used the online installer for the SDK then you already have the latest smart installer build, no need for an update check yet.

And that’s the end of my status report in this post. I’d like to hear what you think of these news, either here or on Twitter.

 

Get the Nokia Qt SDK v1.0 RC

The release candidate version of the Nokia Qt SDK v1.0 is now available for download on Forum Nokia.

 

Qt SDK RC

No major features in this release but a lot of bug fixes, improvements and some component upgrades as well. For a listing of the change log, including bug fixes, see the announcement in the Qt Labs blog.

You can find more information about SDK’s features (and known issues) and for a Getting started tutorial please visit SDK’s pages on the new improved Forum Nokia web site. For more frequently updated content see SDK’s wiki page.

Download link: Nokia Qt SDK

Note: If you have Nokia Qt SDK v1.0 Beta already installed, please remove the Beta first or install in a new location.

We are of course welcoming your feedback about this product. The Forum Nokia Discussion Board is open for your comments and you can report new bugs (or check the status of the old ones) in the Qt Bug Tracker.

Get the Nokia Qt SDK v1.0 RC

The release candidate version of the Nokia Qt SDK v1.0 is now available for download on Forum Nokia.

 

Qt SDK RC

No major features in this release but a lot of bug fixes, improvements and some component upgrades as well. For a listing of the change log, including bug fixes, see the announcement in the Qt Labs blog.

You can find more information about SDK’s features (and known issues) and for a Getting started tutorial please visit SDK’s pages on the new improved Forum Nokia web site. For more frequently updated content see SDK’s wiki page.

Download link: Nokia Qt SDK

Note: If you have Nokia Qt SDK v1.0 Beta already installed, please remove the Beta first or install in a new location.

We are of course welcoming your feedback about this product. The Forum Nokia Discussion Board is open for your comments and you can report new bugs (or check the status of the old ones) in the Qt Bug Tracker.

Carbide.c++ 2.6 update available

This is a quick note for all Carbide.c++ fans out there. ;)

Carbide.c++ v2.6 is available on the software update servers, ready for your to update your environments using the "Software update" feature.

The following new features for Symbian development are provided within
Carbide.c++ (including 2.5 updates you might have missed):

2.6.0

  • GCCE 4.0 supported — required for future SBSv2 releases.
  • Symbian^3 supported — new templates and improvements required for the public Symbian^3 SDK.

2.5.0

  • Plug-and-Play (PnP) On-device Debugging supported — debugging a target device just got easier. Using a USB cable, connect the PC to the target device, then launch Carbide.c++. Carbide locates the connected device and creates a remote connection setup to communicate with it. Build the program and launch it on the device to start the debugging session. Refer to Known PnP Issues for details if you experience problems.
  • PnP Phone Launch Wizard – If the project does not already have a launch configuration, the PnP Launch Wizard makes it easy to create one for phones. In addition the new Configure Launch Configuration dialog provides a quick summary of the remote connection for easy review and modification.
  • Carbide automatically detects TRK on target phones and devices – Carbide now detects the presence of either Application or System TRK on a connected device when TRK 3.2.6 or later are installed. Earlier TRK versions do not support this recognition feature.
  • TRK improvements – TRK continues to evolve and now includes these improvements:

    • Both Application and System TRK v3.2.6 support PnP debugging. Update and install using the Help > On Device Connections > Install Remote Agents pane in the New Connection dialog.
    • VERSION3 command now supported
  • RVCT 4.0 (ARMv5) builds and some limited debugging is supported

There are several bug fixes in the release but some known issues as well:

  • GCCE4 support requires using a
    SBSv2 build alias (-c parameter) of armv5_udeb_gcce or armv5_urel_gcce.
    As of this writing, these aliases were not available in the SDK or
    SBSv2, but will appear in some future version. Carbide versions prior to
    2.6 do not support GCCE4.
  • Users should consult the SDK
    documentation for GCCE and SBSv2 issues and installation requirements.
  • TRK:
    If you install the TRK app onto your phone’s flash memory (Mass
    Storage) a Remote Connection may not find the TRK-service even though
    TRK is already connected to your PC. Workaround: Uninstall TRK then
    reinstall it onto your PHONE memory (C-drive). The TRK service should
    now be "Available".

This is a minor update and should not cause any problems to your existing projects. Of course, that does not mean that you should not make a backup before applying it.

Carbide.c++ 2.6 update available

This is a quick note for all Carbide.c++ fans out there. ;)

Carbide.c++ v2.6 is available on the software update servers, ready for your to update your environments using the "Software update" feature.

The following new features for Symbian development are provided within
Carbide.c++ (including 2.5 updates you might have missed):

2.6.0

  • GCCE 4.0 supported — required for future SBSv2 releases.
  • Symbian^3 supported — new templates and improvements required for the public Symbian^3 SDK.

2.5.0

  • Plug-and-Play (PnP) On-device Debugging supported — debugging a target device just got easier. Using a USB cable, connect the PC to the target device, then launch Carbide.c++. Carbide locates the connected device and creates a remote connection setup to communicate with it. Build the program and launch it on the device to start the debugging session. Refer to Known PnP Issues for details if you experience problems.
  • PnP Phone Launch Wizard – If the project does not already have a launch configuration, the PnP Launch Wizard makes it easy to create one for phones. In addition the new Configure Launch Configuration dialog provides a quick summary of the remote connection for easy review and modification.
  • Carbide automatically detects TRK on target phones and devices – Carbide now detects the presence of either Application or System TRK on a connected device when TRK 3.2.6 or later are installed. Earlier TRK versions do not support this recognition feature.
  • TRK improvements – TRK continues to evolve and now includes these improvements:

    • Both Application and System TRK v3.2.6 support PnP debugging. Update and install using the Help > On Device Connections > Install Remote Agents pane in the New Connection dialog.
    • VERSION3 command now supported
  • RVCT 4.0 (ARMv5) builds and some limited debugging is supported

There are several bug fixes in the release but some known issues as well:

  • GCCE4 support requires using a
    SBSv2 build alias (-c parameter) of armv5_udeb_gcce or armv5_urel_gcce.
    As of this writing, these aliases were not available in the SDK or
    SBSv2, but will appear in some future version. Carbide versions prior to
    2.6 do not support GCCE4.
  • Users should consult the SDK
    documentation for GCCE and SBSv2 issues and installation requirements.
  • TRK:
    If you install the TRK app onto your phone’s flash memory (Mass
    Storage) a Remote Connection may not find the TRK-service even though
    TRK is already connected to your PC. Workaround: Uninstall TRK then
    reinstall it onto your PHONE memory (C-drive). The TRK service should
    now be "Available".

This is a minor update and should not cause any problems to your existing projects. Of course, that does not mean that you should not make a backup before applying it.

Get ready for the next Bug Squad

Staying with the Bug Squad topic while it is hot, here’s a quick update:

In order to support newcomers in their bug hunting activities, the Bug Squad organises a training session this Friday, May 28th at 11 am London time, with the topic “How to build a package”. By attending this introductory one hour session you will learn:

  • How to clone a package
  • How do you know what is the best version to build
  • Building a package with Raptor

To register, visit http://developer.symbian.org/forum/showthread.php?t=6473 and vote.

To stay on top of Bug Squad’s activities, join the mailing list.