×
Namespaces

Variants
Actions

Archived:Launching MIDlets programmatically on S60 3rd Edition

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.


Article Metadata
Compatibility
Platform(s): S60 3rd Edition, S60 3rd Edition FP1
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Created: User:Technical writer 2 (22 Nov 2006)
Last edited: lpvalente (18 Nov 2012)


Contents

Overview

Launching MIDlets programmatically on S60 3rd Edition.

Description

When a MIDlet is installed on an S60 3rd Edition device, it will be assigned a MIDlet-Suite UID and a MIDlet-specific UID, both of which are generated during installation. Files for the MIDlet will be placed in \private\102033E6\MIDlets\[MIDlet Suite UID]

Since the MIDlet files are located in a private directory, it is not possible to access them directly. However, an entry in the list of installed applications is also created for a MIDlet. This list is maintained by the application architecture server, and can be read by using the methods from the RApaLsSession class.

Each MIDlet entry in the list will have a ".fakeapp" extension in the application executable name. This information can be used when scanning through the list to separate MIDlets from native applications. In order to launch a MIDlet from native code, its MIDlet-specific UID must be found.

Solution

The following code snippet shows how to search for all installed MIDlets:

TApaAppInfo appInfo;
RApaLsSession apaSession;
User::LeaveIfError( apaSession.Connect() );
CleanupClosePushL( apaSession );
User::LeaveIfError( apaSession.GetAllApps() );
while ( apaSession.GetNextApp( appInfo ) == KErrNone )
{
if(appInfo.iFullName.Right(8).Compare(_L(".fakeapp") == 0)
{// Caption of the MIDlet can be read from appInfo.iCaption
// When the MIDlet to be launch is found, store its UID
// (appInfo.iUid) for later use.
}
}
CleanupStack::PopAndDestroy();
// close apaSession

Launching the MIDlet

Once the UID of the MIDlet is known, it can be launched as follows:

TThreadId threadId;
apaSession.StartDocument(_L(""), iMidletUID, threadId);

An empty descriptor can be passed as the first parameter (document name).

If the launching application wishes to monitor the MIDlet and receive a notification when it is closed, it can be done by deriving from CActive and calling RThread::Logon():

TInt ret = iLaunchThread.Open(threadId); // iLaunchThread is of type RThread<
if(ret == KErrNone)
{
iLaunchThread.Logon(iStatus);
SetActive();
}

Launching a MIDlet at device startup

S60 does not provide any mechanism for launching MIDlets at device startup. However, using the code above, it is possible to write a minimal Symbian application that finds and launches the MIDlet. This launcher application can be then added to the device startup list.

Note that applications on the startup list must be signed against a trusted certificate.

For more information, see documentation on Startup List Management API on SDK Help.

Related articles

This page was last modified on 18 November 2012, at 00:59.
41 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×