本技术文章,由www.j2megame.com原创, 转载请说明。
方法1:MIDlet 通过 platformRequest,调用手机本地应用程序。
示例:
S60中调用
platformRequest("nativeapp:application-exe=MediaPlayer.exe;content=E:/Feelings.MP3;application-args=-ExampleArgument");
S40中调用
platformRequest("localapp://gallery/show?folder=C:/predefgallery/predefphotos");
方法2:MIDlet通过 platformRequest,调用其他MIDlet。
示例:
S40中
platformRequest("localapp://jam/launch?midlet-name=ArcadeGames;midlet-vendor=Acme;sounds=OFF;difficulty=easy;wizard_mode=ON");
MIDlet启动参数说明
Nokia-MIDlet-Launch-Params: sounds,difficulty,wizard_mode
The ArcadeGames MIDlet can access the parameters as follows:
System.getProperty("sounds"); System.getProperty("difficulty"); System.getProperty("wizard_mode");
platformRequest("javaapp:midlet-name=ArcadeGames;midlet-vendor=Acme;sounds=OFF;difficulty=easy;wizard_mode=ON");通过MIDlet的UID启动platformRequest("javaapp:midlet-uid=0xE1000000;sounds=OFF;difficulty=easy;wizard_mode=ON);
方法3:手机本地应用程序调用MIDlet
代码如下:
The following example code shows how to launch a MIDlet from a native Symbian application.
RProcess rProcess; TInt err = rProcess.Create(_L("javalauncher.exe"), _L("midlet-uid=0x10137c4d;startMode=startFromCmdLine;sound=ON;landscapeMode=true;")); if (KErrNone == err) { TRequestStatus status; rProcess.Logon(status); rProcess.Resume(); // now wait until javalauncher exits User::WaitForRequest(status); if (status.Int() != KErrNone) { // Launching midlet failed err = status.Int(); } } else { // Cannot start javalauncher } rProcess.Close();
The following example code shows how to launch the same MIDlet from a Symbian application using Open C APIs.
include <glib.h> gint exitStatus = 0; // Start javalauncher and wait until it starts midlet gboolean startOK = g_spawn_command_line_sync( "javalauncher midlet-uid=0x10137c4d;startMode=startFromCmdLine;sound=ON;landscapeMode=true;", NULL, NULL, &exitStatus, NULL); if (startOK) { if (exitStatus != 0) { // launching midlet failed, (Symbian) error code in exitStatus } } else { // Cannot start javalauncher }
方法4:MIDlet重新启动
In Series 40 and Symbian, when a MIDlet is already running and it is re-launched, it is set on the foreground and can receive the new command line parameters.
In Symbian, every time a MIDlet is re-launched, the integer value in com.nokia.mid.cmdline.instance
system property is incremented by one. This value can be used to check whether the MIDlet has really been re-launched or just brought to the foreground. The old values of the command line arguments are not changed unless new command line values redefine them. If JAD attribute Nokia-MIDlet-Background-Event
has the value pause
, the startApp
method is called every time the MIDlet is brought to foreground. This provides an easy way to acquire new command line parameters.
方法5:从手机浏览器网站链接启动MIDlet
n Symbian, when a link with the javaapp:
or localapp://jam/launch?
URI scheme is opened on a web page, the corresponding MIDlet is launched. If JavaScript is enabled, a JavaScript function may also activate the link.
Before the MIDlet is started from a web browser link, the auto invocation permission of the MIDlet is checked. This means that in case of third-party MIDlets, the user is always asked at least once to confirm the MIDlet launch.
If you use non-US-ASCII characters in the URL, you must use UTF-8 encoding. Also spaces must be encoded, for example:
javaapp:midlet-name=Arcade Pro;midlet-vendor=Acme;midlet-n=1;sounds=OFF;difficulty=medium
方法6:MIDlet platformRequest其他常用功能
打电话:
platformRequest("tel:+19143680400");
打开网页:
platformRequest("http://www.forum.nokia.com/");
打开1个RTSP流连接:
platformRequest("rtsp://ra.yle.fi/ramgen/tv2/viihde/zencafe.rm");
利用本地默认软件打开1个本地文件
platformRequest("file://E/image.png");
打开短信编辑器,并发短信到指定号码
platformRequest("sms:+19143680400");
其他常用列表及功能:
使用连接后提示用语列表
URI scheme | Supported in Symbian | Supported in Series 40 | Java user confirmation prompt | Behavior |
---|---|---|---|---|
http: | Yes | Yes | "Allow this application to use network for sending/receiving data?" | Open URI in Browser |
https: | Yes | Yes | "Allow this application to use network for sending/receiving data?" | Open URI in Browser |
rtsp: | Yes | Product dependent | No user prompt | RealPlayer starts, asks 'Connection to server needed. Connect?' Y/N |
file: | Yes | No | "Allow this application start an application?" | Open file in MIME type specific application |
mailto: | Yes | Product dependent | No user prompt | Open E-mail or MMS editor |
wtai: | Yes | No | "Allow this application start an application?" | Like tel: / open address book for edit / send DTMF sequence |
mms: | Yes | No | No user prompt | RealPlayer starts, asks 'Connection to server needed. Connect?' Y/N |
cti: | Yes | No | No user prompt | Computer telephony integration. Like tel: |
mmsto: | Yes | No | No user prompt | Open MMS editor |
sms: | Yes | No | No user prompt | Open SMS editor |
localapp: | Yes | Yes | "Allow this application start an application?" | Start local application In Series 40, only allowed for manufacturer and operator MIDlets. In Symbian Java all domains work but only some applications are supported. See following table. |
javaapp: | Yes | No | "Allow this application start an application?" | Start Java application For more information, see Launching a MIDlet from another MIDlet. |
nativeapp: | Yes | No | No user prompt | Start native application. Only allowed for manufacturer and operator MIDlets. For more information, see Launching a native application from a MIDlet. |
tel: | Yes | Yes | No user prompt | Asks confirmation before making phone call |
Added protocols | Yes | No | "Allow this application start an application?" |
|
In Symbian, localapp
supports launching only the following applications:
Symbian本地应用程序列表
Application | Accepted arguments |
---|---|
Contacts |
|
Calendar |
|
Messaging |
|
由www.j2megame.com原创, 转载请说明。