ActionScript Service object

Description

The Service object is a Nokia-proprietary ActionScript 2.0 extension that allows Flash Lite applications to access S60 Platform Services through Service APIs. Each Service API has a service provider name and supports one interface. To instantiate a Service object for a specific Service API, specify the service provider name and the interface name for that Service API.

Note: Before you can create Flash Lite applications that use the Service object, you must install the corresponding ActionScript 2.0 class files for your Flash IDE. For further instructions, see section Using platform services.

The Service object is supported since Flash Lite Player 3.0 on S60 5th Edition devices. While you can publish your application for Flash Lite 2.0 or newer, the Service object only works on S60 5th Edition devices that support Flash Lite 3.0 or newer.

Note: The callback settings feature for resuming applications in the background is supported since Flash Lite Player 3.1.

Syntax

To create a Service object, use the new method. Before using the method, you need to import the com.nokia.lib.Service class.

The following code snippet creates a new Service object:

import com.nokia.lib.Service;
var serviceInstance = new Service(provider, interface);

Arguments

  • provider:

    This is a text string that defines the service provider name, that is, the name of the service.

  • interface:

    This is a text string that defines the supported interface for the specified service provider.

Table: Service API providers and interfaces

Service API

Provider

Interface

AppManager

Service.AppManager

IAppManager

Calendar

Service.Calendar

IDataSource

Contacts

Service.Contact

IDataSource

Landmarks

Service.Landmarks

IDataSource

Location

Service.Location

ILocation

Logging

Service.Logging

IDataSource

Media Management

Service.MediaManagement

IDataSource

Messaging

Service.Messaging

IMessaging

Sensor

Service.Sensor

ISensor

SystemInfo

Service.SysInfo

ISysInfo

Return value

The new method returns a Service object for a successful call. You can use the object to call methods supported by the Service API for which you created the object.

Remarks

Example code

import com.nokia.lib.Service;
import com.nokia.lib.ErrorValue;
var messaging = new Service("Service.Messaging", "IMessaging");
if (ErrorValue.EServiceNotFound==messaging.iError)
{
  // Handle error while instantiating the service.
}