midpjni: how MIDlets can access native services

Question:
Can I access native functionality from a MIDlet?

Answer: 
Not directly since MIDP does not support JNI.

  • However, it is possible for a MIDlet to communicate with a C++ application running on the host device using a standard communication protocol such as TCP/IP sockets.

    For instance the native application can provide a (server) socket listening for incoming connections on a specific port (say 1234). The MIDlet can then use the GCF to opens a client socket connection using the local loopback address to communicate with the native application as follows:

SocketConnection mySocket = (SocketConnection) Connector.open("socket://127.0.0.1:1234");

Once a two way connection has been established the MIDlet client can make requests for data from the native server using a custom protocol understood by both.

Of course this approach relinquishes many of the tradition strengths of MIDP (such as cross platform portability) requiring as it does the implementation, installation and launching of a dedicated native application as well as the MIDlet. However it may provide a route for application developers to leverage existing Java code to a Java implementation with different capabilities, rather than undertake a complete re-write in C++.

For further information see:http://www.symbian.com/developer/techlib/papers/java_MIDP.asp
"Extending the Reach of MIDlets: how MIDlets can access native services"
and
http://midpjni.com/

时间: 2024-08-26 09:03:18

midpjni: how MIDlets can access native services的相关文章

Build Data-Driven Web Services with Updated XML Support for SQL Server 2000

server|services|web|xml Download the code for this article: SQLXML3.exe (239KB) --->SUMMARY XML is becoming the ubiquitous data format on the Web, and XML support in SQL Server is evolving to meet the additional demand. Using XML, SOAP, HTTP, and SQL

.NET 对 J2EE[2]

j2ee Picking a Winner: .NET vs. J2EE Although both frameworks stand on a foundation of programming languages, object models and virtual machines, they are strikingly different when you consider the design goals of their runtime environment. The Java

REST Security with JWT using Java and Spring Security

  Security Security is the enemy of convenience, and vice versa. This statement is true for any system, virtual or real, from the physical house entrance to web banking platforms. Engineers are constantly trying to find the right balance for the give

【OH】Glossary Oracle词汇表(下)

[OH]Glossary Oracle词汇表(下) Oracle? Database Installation Guide 11g Release 2 (11.2) for Linux E47689-05 Glossary ● Oracle Automatic Storage Management disk group A set of disk devices that Oracle Automatic Storage Management (Oracle ASM) manages as a

谈谈Silverlight的一个跨域安全考虑

在文档中看到Silverlight在设计的时候对网络安全方面做了很多考虑.但由于本人对安全方面并不是 特别懂,所以看得挺模糊的.最近和同事黄讨论了其中一些点,得到一些结论,和大家分享一下. 在文档中有这么一段话: There are important security considerations before you allow Silverlight clients to access Web services in a cross-domain situation. Whenever y

Android GUI系统之SurfaceFlinger(12) VSync信号的产生和处理

1.1 VSync的产生和处理 前面小节ProjectButter中我们学习了Android 4.1显示系统中的新特性,其中一个就是加入了VSync同步.我们从理论的角度分析了采用这一机制的必要性和运作机理,那么SurfaceFlinger具体是如何实施的呢? 先来想一下有哪些东西要考虑: · VSync信号的产生和分发 如果有硬件主动发出这一信号,那是最好的了;否则就得通过软件定时模拟来产生 · VSync信号的处理 当信号产生后,SurfaceFlinger如何在最短的时间内响应,具体处理流

Android GUI系统之SurfaceFlinger(10)

SurfaceFlinger的启动与工作原理 1.1.1 SurfaceFlinger的启动 SurfaceFlinger的启动和ServiceManager有点类似,它们都属于系统的底层支撑服务,必需在设备开机的早期就运行起来. /*frameworks/base/cmds/system_server/library/System_init.cpp*/ extern "C" status_t  system_init() {-     property_get("syste

Android GUI系统之SurfaceFlinger(8) 应用程序与BufferQueue的关系

1.1.1 应用程序与BufferQueue的关系 接着上一小节未解决完的问题继续讲解. 现在我们已经明白了应用程序利用SurfaceFlinger进行绘制工作的大致流程了,只不过在这个过程中直到最后才出现了BufferQueue.应用程序具体是如何借助BufferQueue来完成工作的呢? 仔细观察不难发现,当应用端通过ISurfaceComposerClient::createSurface()来发起创建Surface的请求时,SurfaceFlinger服务进程这边会创建一个Layer.既

Android 开机启动慢的原因分析

  开机启动花了40多秒,正常开机只需要28秒就能开机起来. 内核的启动我没有去分析,另一个同事分析的.我主要是分析从SystemServer启来到开机动画结束显示解锁界面的这段时间,也就是开机动画的第三个动画开始到结束这段时间,这是个比较耗时阶段,一般都在17秒左右(见过牛B的手机,只需5秒). SystemServer分两步执行:init1和init2.init1主要是初始化native的服务,代码在system_init.cpp的system_init,初始化了SurfaceFlinger