Updates from February, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • pit 11:17 am on February 16, 2010 Permalink | Reply
    Tags: developers guide, , , , ria,   

    Rich Internet Application developer’s guide for Nokia devices 

    Forum Nokia has recently published a very informative guide about developing RIAs for mobile devices: A developer’s guide to creating Rich Internet Applications for Nokia devices.

    The document focuses on three kind of applications: websites, web apps, and stand-alone Adobe Flash applications, covering all topics involved in design and development of a RIA, from development tools to user experience design and evaluation, from testing to going to market.

    Mobile offers significant opportunities for RIAs. The ability to access data and information anywhere there is a suitable network connection is of significant appeal to mobile users. The knowledge that their data is also securely stored on a remote server, regardless of what happens to the mobile device, is a significant attraction as well.
    With many hundreds of millions of Nokia devices already in the market place that can run RIAs now, there has never been a better time to go mobile with your RIA.

    Check it out!

     
  • pit 11:28 am on February 11, 2010 Permalink | Reply
    Tags: , , , , , ,   

    Platform Services and API Bridge: features, differences and advantages 

    If you’re developing applications for Nokia devices, and more specifically Web Runtime, Flash Lite or Java ME applications, you probably already had to deal with the platform limitations, and with the tools and libraries that allow to go beyond these limitations by adding more capabilities.

    Basically, when you want to extend the functionalities of a WRT widget or a Flash Lite application, you have two options:

    Both of them provide a set of tools and libraries that, added to your applications, allow them to access more functionalities than the ones that each technology naively supports.

    So, which approach is the best one? It’s not easy to give a unique answer to this question, so let’s go into details.

    Ease of use

    The Platform Services library is available from more time, and there’s a well established set of resources and code examples that will help you to quickly get your functionalities ready and running.The primary source of information is Forum Nokia Library, that has a detailed references of APIs and useful sample code. Then, also Forum Nokia Wiki provides an extensive set of examples that cover all the possible usage scenarios. Even if there is some little parts where this information could be improved, you shouldn’t get much in trouble when using Platform Services in your application.

    API Bridge is a fresher technology, released on November 2009, and so it’s harder to find complete documentation and usage examples. Anyway, Forum Nokia released a set of libraries for various platforms (Flash Lite, Web Runtime and Java ME) that will definitely help in starting to use API Bridge.

    Device support

    Platform Services are fully supported starting from S60 5th edition devices, but are also compatible with a subset of S60 3rd edition Feature Pack 2 devices: the full list of supported devices is available here: Web Runtime 1.1 compatible devices. This means that you can use them only on the touch screen Nokia devices.

    On the other side, API Bridge can work on all devices starting from S60 3rd edition Feature Pack 1 onwards, so meaning:

    Available features

    Current Platform Services (version 1.0) allow to access a wide set of features:

    • Application Management
    • Calendar
    • Contacts
    • Landmarks
    • Location
    • Logging
    • Media Management
    • Messaging
    • Sensors
    • System Information

    It is currently available also a beta release of Platform Services 2.0, that adds to this features’ set also the access to the device camera.

    API Bridge, instead, has a more limited set of functionalities, currently including:

    • Capture of photos, videos and audio streams
    • Files uploading
    • Files reading
    • Image resizing
    • Location
    • Logging
    • Media Management

    Supported technologies

    Platform Services are currently available for Flash Lite and Web Runtime applications.

    API Bridge libraries have been released for Flash Lite, Web Runtime and Java ME. Generally speaking, the API Bridge engine, working as a local HTTP server running on the device, is accessible from all technologies.

    Overall considerations

    The current implementation of Platform Services and API Bridge don’t allow to decide which approach is the best one, and there is no need to do it anyway. Right now, if you’re working in Flash Lite or Web Runtime, and as long as your set of target devices support them, you can benefit of both technologies, including the two libraries in your application.

    Talking about future perspectives of both approaches, we can see both of them evolving in more mature products.

    Platform Services 2.0 is already available as a beta release, so you can already start experimenting with the new APIs and features, including the access to the device camera. On the other side, API Bridge promises to allow everyone to create custom plugins, through the ECOM interface, as reported on Forum Nokia Blogs.

    Concluding, Platform Services, with the already mature and features-rich library, surely represents a simpler approach for developers who don’t want to deal with Symbian building and packaging, while API Bridge, with its plugin architecture becoming mature and open to developers, could definitely end up to be the best ally to allow widgets and Flash Lite apps access more and more features.

     
    • Trufanov 6:33 pm on February 11, 2010 Permalink

      >On the other side, API Bridge promises to allow everyone to create custom plugins, through the ECOM interface, as reported on Forum Nokia Blogs.

      They just release APIBridge Plug-in API: http://wiki.forum.nokia.com/index.php/APIBridge_Plug-in_API

    • pit 6:52 pm on February 11, 2010 Permalink

      Hi Trufanov,

      you’re right! Just noticed the same thing :)

    • rondo 10:24 am on August 9, 2010 Permalink

      Hi pit,
      I hava a problem using APIBridge.fileUpload method to upload a photo to the server. The method failed with error:404. The problem is driving me mad ! Do you have any suggestions?

  • pit 11:58 pm on February 9, 2010 Permalink | Reply
    Tags: , , , , , ,   

    How to use Nokia API Bridge in Flash Lite with FDT 

    API Bridge is a Symbian engine that exposes a set of native functionalities to Web Runtime, Flash Lite and Java ME applications. Nokia has recently released an ActionScript library that allows to easily integrate APIBridge functionalities in a Flash Lite application.

    In this article I’ll try to explain how to setup and develop a Flash Lite application that uses APIBridge, by using FDT.

    If you want to know how to configure FDT (and Eclipse) to properly develop Flash Lite application, you should read this article: Web Runtime and Flash Lite integrated development on Eclipse.

    Setup the project in FDT

    First of all, you need to download the API Bridge FlashLite library from Forum Nokia: API Bridge Flash Lite Library and Sample Code. The package also contains useful sample code that will definitely help.

    Now, create a new Flash Lite project within Eclipse.

    Then, open up the API Bridge package downloaded from Forum Nokia, and copy the “si/” folder to the “src/” folder of your Flash Lite project.

    Once copied, you should notice some errors in your FDT project, as shown in the picture below.

    These errors are due to the “mx.*” package, that is not included in the ActionScript classes shipped with FDT. To solve this error, you have to tell FDT where to find these classes.

    First, let’s copy these classes from the Flash IDE to a dedicated folder:

    1. Create a folder called “mx_package/” somewhere on your machine
    2. Go into “<FLASH_IDE_PATH>\en\First Run\Classes\” folder
    3. Copy the “mx/” folder inside the “mx_package/” folder created above

    Now, configure FDT:

    1. Go into “Window” -> “Preferences” -> “FDT” -> “Core Libraries”, open the “Path variables” panel and select “New…”
    2. Enter “MX_PACKAGE” as name, and select the “mx_package/” created above as folder
    3. Once done, your Core Libraries should look similar to the picture below

    Now, what remains to do is to add the MX library to the Flash Lite project. Go into the project’s properties and, in the “FDT Build Path” section, select “Add Linked Library…” -> “Add…” and pick “MX_PACKAGE”.

    Done this, all the errors should have gone away from the project. Hurrah! :)

    Patching the mx.utils.Delegate class

    The MTASC compiler is stricter than the compiler you can find within the Flash IDE. For this reason, the mx.utils.Delegate class needs to be slightly modified in order to make it properly compile with MTASC.

    Specifically, the ‘create()’ function needs to be adjusted as follows:

    static function create(obj:Object, func:Function):Function
    {
    	var f = function()
    	{
    		var target = arguments.callee.target;
    		var func2 = arguments.callee.func;
    		return func2.apply(target, arguments);
    	};
    	f.target = obj;
    	f.func = func;
    	return f;
    }

    Patching the si.apibridge.APIBridge class

    For the same reasons explained above, also the si.apibridge.APIBridge class needs to be patched to work with MTASC.  To do this, open APIBridge.as and replace the setPort() function with this one:

    	private function setPort(): Void
    	{
    		var portVars:LoadVars = new LoadVars();
     
    		portVars.load( portPath );
     
    		var pushErrorDelegate : Function = Delegate.create(this, pushError);
     
    		portVars.onLoad = function( success )
    		{
    			if (success)
    			{
    				var portData:String = portVars.toString();
    				portData = portData.substr(0,portData.indexOf("="));
    				trace(portData);
    				APIBridge.BridgeURL += portData; 
     
    			}
    			else
    			{
    				trace("Error loading Port");// The data didn't load
    				pushErrorDelegate("1","Error loading port, using default 9080");
    				APIBridge.BridgeURL += "9080";
    			}
     
    		}
    	}

    Once done, just create a new MTASC launch configuration and check that the project properly compiles. If it doesn’t, re-check the steps above.

    Using API Bridge Call Log service in Flash Lite

    Now, we’ll see how to use an API Bridge service, the Call Log one, in Flash Lite.

    First, let’s create the main project’s class. In this example I’ll call it ‘MainMovie’.

    import com.jappit.flashlite.apibridgetest.Logger;
    import com.jappit.flashlite.apibridgetest.CallLogRetriever;
     
    class com.jappit.flashlite.apibridgetest.MainMovie
    {
    	public static function main(container : MovieClip) : Void
    	{
    		Stage.align = "TL";
    		Stage.scaleMode = "noScale";
    		container.createTextField("tf", 1, 0, 0, 360, 500);
    		var textField : TextField = container["tf"];
    	}
    }

    The TextField instance will be used to show the events retrieved from the device logs. Now, let’s create a separate class, EventsLogRetriever, that will take care of calling APIBridge, and of managing its responses. Its constructor is defined to accept a TextField as argument, and it will use it to print out the API Bridge response.

    import mx.utils.Delegate;
    import si.apibridge.*;
     
    class com.jappit.flashlite.apibridgetest.EventsLogRetriever
    {
    	private var textField : TextField;
     
    	public function EventsLogRetriever(_textField : TextField)
    	{
    		this.textField = _textField;
    	}

    Now, it’s time to define the method that will call the API Bridge engine. Each call to an API Bridge interface must typically define two handlers: a success and a failure handler. The error handler receives a single argument, containing the data of the occurred error. About the success handler, it receives three arguments:

    1. the transaction ID, that must be used to uniquely identify the transaction that is calling the handler (useful in scenarios where multiple transactions are active concurrently)
    2. the event ID, that identify the state of the event
    3. an object containing data returned by the API Bridge call

    Said that, the EventsLogRetriever class will end up containing these 3 methods:

    public function retrieveEvents() : Void
    {
    }
    public function onApiError(outParam : Object) : Void
    {
    }
    public function onApiSuccess(transactionID:Number, eventID:String, outParam:Object)
    {
    }

    Starting with the retrieveEvents() method, it has to:

    • instantiate APIBridge, passing a reference to the error handler as argument
    • grab a reference to the Logging service
    • define which kind of log events it wants to retrieve
    • call the GetList() service method

    So, the retrieveEvents() can be implemented as follows:

    public function retrieveEvents() : Void
    {
    	var _onApiError : Function = Delegate.create(this, onApiError);
    	var _onApiSuccess : Function = Delegate.create(this, onApiSuccess);
     
    	var bridge:APIBridge = new APIBridge(_onApiError);
     
    	var logging = bridge.Service("Service.Logging", "IDataSource");
     
    	textField.text  = "Retrieving phone numbers ..." + APIBridge.BridgeURL;
     
    	var filter = {EventType:0};
    	var inParams = {Type:"Log", Filter:filter};
     
    	logging.GetList(inParams, _onApiSuccess);
    }

    Coming to the error handler, let’s just implement it to make it show the returned error data:

    public function onApiError(outParam : Object) : Void
    {
    	textField.text  = "APIBridge error " + outParam.ErrorCode + " " + outParam.ErrorMessage;
    }

    Now, the success handler. First, it has to check if the returned API Bridge data contains an error, and this can be done with the same logic used in the error handler above. If no errors are detected, the handler can retrieve the actual returned data, contained in outParam.ReturnValue, and loop all the returned log events.

    public function onApiSuccess(transactionID : Number, eventID : String, outParam : Object)
    {
    	textField.text = "Results: " + outParam.ReturnValue.length + "\n" ;
     
    	if (outParam.ErrorCode != 0)
    	{
    		textField.text = "Error: " + outParam.ErrorCode + ", " + outParam.ErrorMessage;
    		return;
    	}
    	else
    	{
    		var outList = outParam.ReturnValue;
    		var outputEntry = null;
    		do
    		{
    			outputEntry = outList.next();
     
    			if (null != outputEntry)
    			{
    				textField.text += outputEntry.Direction + ": " +
    					outputEntry.Description + ", " +
    					outputEntry.PhoneNumber;
     
    				textField.text += "\n";
    			}
    			else
    			{
    				break;
    			}
    		}
    		while (true);
    	}
    }

    Done this, the EventsLogRetriever is ready to be used, and to do this it’ll be enough to add this two lines to the static() method of the MainMovie class:

    var retriever : EventsLogRetriever = new EventsLogRetriever(textField);
     
    retriever.retrieveEvents();

    That’s all!

    Build and deploy

    Once the Flash Lite app is ready, just build it using the MTASC launch configuration created before.

    Now the tough part: to make the whole thing work, it is necessary to package the Flash Lite application with the API Bridge engine. To do this, there are various options:

    1. Build a Flash Lite launcher in Symbian C++. These Forum Nokia Wiki articles explain how this can be done:
    2. Package the Flash Lite application in a WRT widget, and then package it with the API Bridge engine. This approach is described in these articles:

    Both the approaches can equally work, so feel free to choose the one you prefer :)

    Once deployed on a device, just run it, and you should see this:

    1) The Flash Lite app starts, and the API Engine is initialized

    2) The API Bridge engine asks the user for permission to access sensitive data

    3) And here are the retrieved log events!

     
  • pit 11:04 pm on February 8, 2010 Permalink | Reply
    Tags: , , , , ,   

    How to use FDT and Aptana to create a Flash Lite enabled WRT widget 

    We’ve seen, in this previous post, how to setup Eclipse in order to develop both Web Runtime widgets and Flash Lite applications, thanks to Aptana, the Nokia Web Runtime plugin and FDT. This article will focus on how to create a Web Runtime widget that includes some Flash Lite content.

    First of all, be sure to have installed all the required Eclipse plugins, as described here.

    Create a new Web Runtime widget

    To create a Web Runtime widget, just open up the “New Project” wizard and select the “New Nokia Web Runtime Widget”.

    The wizard will now let you choose from some predefined widget templates. In this article, it is enough to start with an empty widget.

    And finally enter the name and identifier of your new widget. The identifier has to be a string in the reverse domain format, and will uniquely identify your own widget.

    Once created, the widget’s structure should be the one shown below.

    Create the Flash Lite content

    First, create a new Flash Lite project by using the “New Flash Project” template. Then, create the project’s main class. One example is the MainMovie class shown below:

    class com.jappit.flashlitetest1.MainMovie
    {
    	public function MainMovie()
    	{
    	}
     
    	public static function main(container : MovieClip) : Void
    	{
    		Stage.align = "TL";
    		Stage.scaleMode = "noScale";
    		container.createTextField("tf", 1, 0, 0, 100, 100);
    		var tf : TextField = container["tf"];
    		tf.text = "I'm the Flash Lite content!";
    	}
    }

    Changing the MTASC launch configuration

    Now, the MTASC command has to be changed a bit, so that the generated SWF will automatically end up in the Web Runtime widget project’s folder.

    To do this, open up the MTASC launch configuration, and change the generated SWF path to be a subpath of your widget’s main folder. You can see an example of the command in the picture below.

    Now, run the project launch configuration, and check the widget’s folder: the SWF generated by MTASC should be there, together with the other widget’s files.

    Including the SWF content in your widget

    Forum Nokia Wiki has a comprehensive article explaining the possible ways of integrating Flash content into a Web Runtime widget. In this article the first described approach, the same used on the Web, is implemented.

    So, take the widget’s index.html file, and add this HTML code:

    <object id="MyFlash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="200" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
    	<param name="align" value="middle" />
    	<param name="allowScriptAccess" value="sameDomain" />
    	<param name="loop" value="false" />
    	<param name="menu" value="false" />
    	<param name="quality" value="high" />
    	<param name="wmode" value="opaque" />
    	<param name="bgcolor" value="#ffffff" />
    	<param name="src" value="default_mtasc.swf" />
    	<param name="name" value="Finish" />
    	<embed id="MyFlash" type="application/x-shockwave-flash" width="200" height="200" src="default_mtasc.swf" name="Finish" bgcolor="#ffffff" wmode="opaque" quality="high" menu="false" loop="false" allowscriptaccess="sameDomain" align="middle"></embed>
    </object>

    Packaging and deploying

    If all went well, all is ready to be packaged and deployed.

    Right click the project, choose “Package widget”, deploy and enjoy! :)

    You can download the widget built in this article here: Flash Lite enabled WRT sample widget.

     
    • Wez 11:42 pm on February 8, 2010 Permalink

      Thanks for the write up man.

    • Bill Perry 10:05 am on February 9, 2010 Permalink

      nice article, thanks for posting.

    • pit 10:20 am on February 9, 2010 Permalink

      Thank you! Glad to know you liked the article :)

  • pit 4:51 pm on February 8, 2010 Permalink | Reply
    Tags: , , , , , mtasc, ,   

    Web Runtime and Flash Lite integrated development on Eclipse 

    Nokia devices offer a wide range of technologies and languages that can be used to create mobile applications. Two of these are strictly related each other, and can be used together to create applications that benefit of both sides: Flash Lite and Web Runtime.

    For this reason, in this article I’ll try to explain how to setup a single environment that may allow development on both technologies, so leveraging the development phase from continuous swaps between different IDEs, and by boosting it all thanks to the powerful Eclipse platform.

    Installing Eclipse and plugins

    First of all, download Eclipse. I currently use version 3.5 on my own machine, but other versions should work as well.

    Once downloaded, proceed installing the following plugins:

    1. Aptana plugin for Eclipse: http://www.aptana.org/studio/plugin
    2. Web Runtime plugin for Aptana: http://tools.ext.nokia.com/wrt/prod/aptana/plugin/
    3. FDT plugin for Eclipse: http://www.fdt.powerflasher.com/developer-tools/fdt-3/download/

    After you’ve installed the above plugins, you’ll notice two new project types in your Eclipse project wizard: Flash and Nokia Web Runtime projects.

    Basically, these 3 plugins are all you need to start developing both Web Runtime and Flash Lite applications. Anyway, FDT needs some further configuration steps to properly work with Flash Lite apps.

    Configure the FDT plugin

    FDT needs to know how to compile your Flash Lite projects. You basically have two choices: use the Adobe Flash IDE, or use MTASC.

    • The first choice is available if you have already installed a copy of a Flash IDE, and can be configured by going into the “Window” -> “Preferences” -> “FDT” -> “Tools” -> “Flash” settings panel. Once there, just enter the paths of your Flash IDE and Player.

    • The second one, quicker and free, needs MTASC to be installed on your machine (you can get it here), and configured in the “Window” -> “Preferences” -> “FDT” -> “Tools” -> “MTASC” panel. I actually prefer this option, as it allows you to develop Flash Lite applications also on machines where the Flash IDE is not available.

    Add Flash Lite-specific classes and functions

    FDT uses the standard ActionScript 2 classes to allow you to compile your Flash Lite project. Anyway, these lack some Flash Lite-specific classes and functions, as ExtendedKey and SharedObject.addListener() method, that have to be manually added, as also explained here.

    To do this, go into the “<ECLIPSE_ROOT_FOLDER>\configuration\com.powerflasher.fdt.core\.config\core\as2\” folder and:

    1. Create a file called “ExtendedKey.as” with this content:
      intrinsic class ExtendedKey
      {
      static var SOFT1:String = "soft1";
      static var SOFT2:String = "soft2";
      static var SOFT3:String = "soft3";
      static var SOFT4:String = "soft4";
      static var SOFT5:String = "soft5";
      static var SOFT6:String = "soft6";
      static var SOFT7:String = "soft7";
      static var SOFT8:String = "soft8";
      static var SOFT9:String = "soft9";
      static var SOFT10:String = "soft10";
      static var SOFT11:String = "soft11";
      static var SOFT12:String = "soft12";
      }
    2. Open “SharedObject.as” and add these lines to the class definition:
      var scope : Object;
      static function GetMaxSize() : Number;
      static function addListener(objectName:String, notifyFunction:Function) : Void;
      static function removeListener(objectName:String) : Void;
    3. Now, switch to the “<ECLIPSE_ROOT_FOLDER>\configuration\com.powerflasher.fdt.core\.config\topLevel\” folder, open TopLevel.as, and add this function definition:
      function fscommand2(command:String, parameters:Object):Void;

      If you plan to use MTASC to compile your Flash Lite applications, the above changes have to be performed also to the ActionScript files used by MTASC itself. These files are typically placed in the “<MTASC_ROOT_FOLDER>\std” folder: go there and repeat the 3 steps above for ExtendedKey.as, SharedObject.as and TopLevel.as.

      That’s all! Now let’s give FDT a quick test to check if all is correctly configured.

      Testing the FDT configuration

      Creating a new Flash Lite project is straightforward: just select “New Flash project” from the Eclipse project wizard, and then choose a name for your project. In the Project Language section, be sure to select “ActionScript 2″.

      Once the project has been created, switch to the “Flash FDT” perspective by selecting “Window” -> “Open perspective” -> “Flash FDT”.

      Now, create the project’s main class. The only required method to be implemented is the static main(), that has to perform all the initialization operations:

      class com.jappit.flashlitetest1.MainMovie
      {
        public function MainMovie()
        {
        }
       
        public static function main(container : MovieClip) : Void
        {
          Stage.align = "TL";
          Stage.scaleMode = "noScale";
          container.createTextField("tf", 1, 0, 0, 100, 100);
          var tf : TextField = container["tf"];
          tf.text = "Hello World";
        }
      }

      Now, if the FDT configuration was properly done, you shouldn’t get any errors. So, if all is ok, open the “Run Configurations…” panel from the “Run” menu.

      Under “FDT MTASC” create a new launch configuration. In the “Main” sub-panel select the main class created just above.

      Then, go to the “Miscellaneous” sub-panel and check the “Start SWF after compilation” option. This way, the SWF will be immediately launched, after each build, in the Eclipse’s internal SWF viewer.

      Now, all is ready to be tested: just run the created launch configuration, and enjoy your new Flash Lite app :)

      And here’s the generated SWF running on a real device:

      What’s next?

      Next tutorials will focus on using both Web Runtime and FDT plugins to develop Flash Lite-enabled widgets. So, stay tuned!

       
    • pit 11:47 am on November 16, 2009 Permalink | Reply
      Tags: , air mobile, ,   

      Adobe Flash Lite Distributable dropped 

      Just came back from a relaxing weekend, with a totally un-relaxing news: as reported, among others, by Leonardo, Alessandro and Mariam, Adobe just dropped the Flash Lite Distributable Player, to entirely focus on Flash 10.1 (for the mobile browser), Air Mobile (for standalone) and Flash Lite 4 (for low-end devices).

      This is a huge, even if someway predictable, news for all mobile developers and companies that have been and are currently focusing their efforts around the Flash Lite Distributable player to provide their content to users.

      I imagine some more news coming in the following days or weeks, that would help to clarify how mobile devices, distributions channels and development tools will evolve. Right now, we can just guess it’ll take some time to have a new, clear strategy built around Flash on mobile, and I’d be glad to hear your opinions about this.

      Meanwhile, let’s join Dale in his minute of silence for the brave Dandelion! :)

       
    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