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/
目录
相关文章
|
3月前
|
存储 应用服务中间件 开发工具
Platform as a Service
PaaS(Platform as a Service,平台即服务)是一种云计算服务模型,它提供了一组开发工具和服务,使开发人员可以构建和部署应用程序,而无需关心底层基础设施的管理。PaaS 通常包括一个操作系统级别的基础设施、服务器、存储和网络服务,以及一系列开发工具和服务,如数据库、Web 服务器、应用服务器、消息传递、身份认证等。
56 2
Platform as a Service
|
7月前
|
Apache Windows
(MAC) Apache You don't have permission to access / on this server.
(MAC) Apache You don't have permission to access / on this server.
44 0
|
PHP
【laravel】访问时You don‘t have permission to access on this server.
【laravel】访问时You don‘t have permission to access on this server.
259 0
【laravel】访问时You don‘t have permission to access on this server.
如何处理SAP CRM Web Service错误 - Virtual Interface Method XXXX not supported
如何处理SAP CRM Web Service错误 - Virtual Interface Method XXXX not supported
155 0
如何处理SAP CRM Web Service错误 - Virtual Interface Method XXXX not supported
|
开发工具 对象存储
How to Apply Alibaba Cloud Object Storage Service Resources to Websites
This article discusses the various applications of OSS and addresses some of the most common issues when applying OSS to websites.
1739 0
|
Go Android开发
Key Management Services Android Demo using Alibaba Cloud KMS Service
In this tutorial, we will explore how to use the Key Management Service to create, control, and manage your encryption keys on your mobile device.
2123 0