J2me MIDlet操作手机功能性用法总结(如调用其他程序或者调用其他MIDlet)

本技术文章,由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"); 

 

 

其他常用列表及功能:

使用连接后提示用语列表

Table: Supported URI schemes:

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本地应用程序列表

Table: Localapp usage in Symbian

Application

Accepted arguments

Contacts

localapp://contacs

Calendar

localapp://calendar/Today

localapp://calendar

Messaging

localapp://messaging

 

www.j2megame.com原创, 转载请说明。

本教程首先介绍了 j2me 开发体系,然后深入各个MIDP2.0 API,最后是搭建平台的知识。 第一章 “J2ME 技术概述”让你在学习J2ME 以前知道什么是J2ME。本章介绍了J2ME 平 台的体系结构和MIDlet 生命周期的概念。为以后的内容打下良好的基础。 第二章“CLDC 简介”介绍了MIDP 的基础Java Community Process(JCP)公布的CLDC1.0 规范(即JSR30)。有了这些知识你就可以顺利的从j2se 的基础API 过渡到MIDP 的基础API 上了。 第三章“MIDP 高级UI 的使用”介绍了MIDP 的可移植UI API,我们称之为高级UI。这 样您的应用就可以栩栩如生了。 第四章“MIDP 低级UI 的使用” 介绍了MIDP 的不可移植UI API,我们称之为低级UI。 利用他你可以更加自由的绘画你的UI。你将了解到关于事件处理的很多知识。 第五章“MIDP 的持久化解决方案— RMS” 为我们讲解了数据持久化机制——记录管理 系统(Record Management System RMS)。这一特别的小型数据库使得MIDP 的数据保存变得很特 别。 第六章“GAME API” 介绍了 MIDP 2.0 相对于1.0 来说,最大的变化——新添加的用于支 持游戏的API,它们被放在javax.microedition.lcdui.game 包中。游戏API 包提供了一系列针对无 线设备的游戏开发类。你可以开发你的游戏了。COOL! 第七章“开发无线网络应用程序” 让我们学习如何开发令人激动的联网应用。无线网络在 当今的技术下与有线网络相比它的带宽更小、延迟更大、连接的稳定性更差。这要求我们在开 发无线联网应用程序时,和以往有很大不同。 第八章“MIDP 2.0 安全体系结构” 将主要介绍MIDP 的安全体系模型,并结合一个具体的 实例来讲述MIDP2.0 安全模型的主要概念。 第九章“MIDP 2.0 Push 技术”介绍了如何通过异步方式将信息传送给设备并自动启动 J2ME 中文教程 by www.j2medev.com MIDlet 程序的机制。 第十章“MIDlet 的开发流程与部署”介绍了如何真正完成你的程序并打包发往设备运行。 第十一章“搭建开发平台—WTK”主要讲述J2ME 新手最常使用的开发工具Wireless Toolkit (WTK)。从WTK 的安装、到MIDlet 项目的创建、以及最后的打包发布,一步步带领读者进 入MIDlet 的开发世界! 第十二章“搭建开发平台—Eclipse”讲述了如何利用EclipseME 作为Eclipse 一个插件,帮 助开发者开发J2ME 应用程序。 第十三章“搭建开发平台—JBuilder”介绍了如何利用久负盛名的JBuilder 作为开发工具来 开发J2ME 应用程序
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值