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.
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);
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.
|
Service API |
Provider |
Interface |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
For more information about using the Service object,
see the following sections:
On some S60 5th Edition devices, the Flash Lite Player can experience a screen refresh error if a Platform Service is instantiated after changing the screen size. For a solution to the problem, see this Forum Nokia discussion thread.
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.
}