Tagged: s60 Toggle Comment Threads | Keyboard Shortcuts

  • pit 3:09 pm on November 27, 2008 Permalink | Reply
    Tags: , asynchronous, , , , , , , s60, service api, , synchronous, ,   

    Web Runtime Service API: handling synchronous and asynchronous calls 

    Just back from another month of deep work, with a brand new article :)

    With S60 5th edition, Web Runtime and Flash Lite gained access to Platform Services: this means that you can finally access application data, location, sensors and system information directly from your Flash Lite application or WRT widget.

    Talking about Web Runtime, new Service APIs were introduced to let you integrate those functionality with simple JavaScript code.

    Among the various concepts to learn when dealing with these APIs, there is the synchronous/asynchronous way of calling each single method: this, apart from being a difference from a programming point of view, brings to different approaches and results on your WRT Widget.

    This “WRT Service API Synchronous and Asynchronous calls” article on Forum Nokia Wiki will guide through the details of these differences, explaining how to use both of them, and underlining possible advantages of the one over the other.

    As always, any kind of feedbacks is welcome! :)

     
  • pit 3:02 pm on October 8, 2008 Permalink | Reply
    Tags: , , , ringtones, s60, ,   

    Create your first Flash Lite ringtone with KuneriLite 

    For those of you who missed it (really??) latest KuneriLite versions have added support for Flash Lite ringtones, one of the coolest FlashLite features around!!

    Today, we’ll see how it is simple to create a FlashLite ringtone with caller-id support and an application that allows users to easily set and unset it.

    Step 1: The FlashLite ringtone

    To start, we’ll build a really simple FlashLite ringtone.

    Let’s start building a simple interface, with these elements:

    Now it’s time to add some ActionScript to our interface. So, let’s open frame 1 of our Actions layer.

    Important note: when using KuneriLite from a ringtone SWF, you MUST use port 2001.

    First, we’ll define a method to retrieve caller infos, and display it, depending on the returned data:

    var loader:LoadVars = new LoadVars();
     
    getCallerName();
     
    function getCallerName()
    {
    	commandOutput.text = "Getting caller's info... ";
     
    	loader.onLoad = callerNameHandler;
     
    	loader.load("http://127.0.0.1:2001/Basic/ring?klCommand=callerid");
    }
    function callerNameHandler()
    {
    	commandOutput.text += this.toString();
     
    	if(this.klError != 0)
    	{
    		callerName.text = "Command error: " + this.klError;
    	}
    	else if(this.klName != undefined)
    	{
    		callerName.text = this.klName;
    	}
    	else
    	{
    		callerName.text = this.klNumber;
    	}
    }

    And then, let’s add the call answer/reject functionality to our ringtone. Two other KuneriLite calls will do the job (note that we’ll reuse the LoadVars instance defined above):

    answer.onPress = function()
    {
    	commandOutput.text = "Answering call... ";
     
    	loader.onLoad = callCommandHandler;
     
    	loader.load("http://127.0.0.1:2001/Basic/ring?klCommand=answercall");
    }
    reject.onPress = function()
    {
    	commandOutput.text = "Rejecting call... ";
     
    	loader.onLoad = callCommandHandler;
     
    	loader.load("http://127.0.0.1:2001/Basic/ring?klCommand=hangupcall");
    }
    function callCommandHandler()
    {
    	commandOutput.text += this.toString();
    }

    Important note: since KuneriLite ringtone plugin already handles device answer and reject keys (the green and red one) you could avoid implementing your custom buttons in ringtone SWF (thanks Jukka for the reminder!)

    Step 2: Setting and unsetting the ringtone

    Now, it’s time to build the “main” SWF application, that is the one that the user would launch from phone menu to manage its FlashLite ringtones.

    As usual, let’s create a basic interface, with this layout:

    Now, let’s add the necessary ActionScript code to our Buttons.
    This is for the enable button:

    enableButton.onPress = function()
    {
    	commandOutput.text = "Enabling ringtone..";
     
    	var loader:LoadVars = new LoadVars();
     
    	loader.onLoad = handleResponse;
     
    	loader.load("http://127.0.0.1:1001/Basic/ring?klCommand=enableringswf&klPath=ringtone.swf");
    }

    And similarly, this is for the disable button:

    disableButton.onPress = function()
    {
    	commandOutput.text = "Disabling ringtone..";
     
    	var loader:LoadVars = new LoadVars();
     
    	loader.onLoad = handleResponse;
     
    	loader.load("http://127.0.0.1:1001/Basic/ring?klCommand=disableringswf&klPath=ringtone.swf");
    }

    And here’s the handler, used by both commands calls, to print out the KuneriLite response error code:

    function handleResponse()
    {
    	commandOutput.text += " Error code: " + this.klError;
    }

    Step 3: building and testing

    Building a KuneriLite app is easy as always, but you need to follow these 4 specific steps to make the ringtone correctly work:

    1. Select Ringtone plugin
    2. Place your ringtone SWF in a separate folder, containing only that SWF, and then select it on Wizard Step 2
    3. Select the ringtone setter as main SWF
    4. Since Ringtone plugin needs signing, on Step 3 fill in the certificate infos

    Once done, just compile and transfer your SIS on your phone, install and launch it:

    • on main app screen, click the enable button
    • check the command output, to see if the command executed successfully: you should see this message
      Enabling ringtone... Error code: 0
    • if yes, just close the app and call your own phone, and your FlashLite ringtone will magically appear!
    • within the ringtone SWF you will see the caller’s name (if available on your phonebook), otherwise its phone number
    • to answer or reject the incoming call, simply use the buttons we previously placed on stage

    That’s it!

    Conclusions

    Now, add this with the other KuneriLite features, and you could end up having:

    • browsable ringtones catalogs, directly downloadable from your FlashLite app
    • ringones for specific contacts (a phonebook plugin would be great!)
    • location-based ringones!

    Isn’t this enough?

     
    • José Xavier 6:14 pm on October 8, 2008 Permalink

      Hi,
      Can i translate your tutorial to portuguese to post in my blog and ofcourse i’ll say that tutorial is yours… sorry my english.
      :)

    • Jukka 11:07 am on October 9, 2008 Permalink

      Hi Alessandro,
      awesome tutorial as usual :)

      One comment: Handling answer and reject buttons in Flash Lite is actually unnecessary, since KuneriLite ringtone plugin handles the ‘green’ and ‘red’ dialkeys.
      They are naturally used when answering a call ;)

    • pit 11:42 am on October 9, 2008 Permalink

      Hi all!

      @José: sure, feel free to translate it to portuguese!

      @Jukka: thanks for the reminder! I’ve added this info to the article :)

  • pit 11:23 am on October 3, 2008 Permalink | Reply
    Tags: , , s60,   

    Nokia S60 5th Edition is out: long life to the Web! 

    Big news for all Nokia followers! Nokia has just launched S60 5th Edition together with the first device supporting it: the Nokia 5800 XpressMusic.

    For all nightly coders, SDK is already available here.

    New improvements and features are available for quite every supported technologies, but biggest ones seems to be related to Flash Lite and Web platforms.

    Both Web and Flash Lite developers now gain access to a previously unavailable (at least, without using any external engine, like KuneriLite or Janus) set of infos and platform services that will allow them to finally build full-blown apps with native functionalities, and no more simple web-aware ones.

    A quick tour of these will explain why we should expect great Flash Lite (and Web) apps in the next future:

    • Calendar
    • Contacts
    • Logs
    • Messaging (SMS and MMS)
    • device location and landmarks
    • system information
    • sensors

    Nokia direction towards Web technologies was already clear (Widget Contributions Contest has just finished on Forum Nokia Wiki), but now we finally have a platform that could let those technologies literally explore new paths.

    Ready?

     
  • pit 12:00 pm on April 28, 2008 Permalink | Reply
    Tags: , , s60,   

    New KuneriLite version with cool improvements 

    KuneriLite is a great tool to extend FlashLite functionalities adding support for native features like local filesystem read/write, camera recording, accelerometer capabilities and much more. All these without the need to have any Symbian knowledge.

    Practically, you interact with KuneriLite engine via localhost calls. For example, if you want to get recursive folder listing starting from current application base path, you can simply do:

    loadVariables("http://127.0.0.1:1001/Basic/file?
    klCommand=dir&klPath=\\&klArgs=/s", targetMc);

    Their tool comes with an integrated wizard and an emulator, to be used with Symbian S60 3rd edition SDK Maintenance Release, to allow full development without the need of a real device.

    KuneriLite logo

    Now they’ve just released 0.9.6.1 version, that fixes issues with Flash Lite 3 and add new cool features, as you can read on their blog, and it’s more than ever worth a try!

     
    • Ugur 2:30 pm on April 28, 2008 Permalink

      Thanks for the post Pit! Great to hear you like it :)

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel