让变化成为计划的一部分

欢迎大家探讨本Blog涉及的所有软件课题。我的Google Talk ID:zhengyun(at)gmail.com。

我最希望软件带给用户的感受是:美好的体验、舒适感、简约、干净...

posts - 32, comments - 8, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

我的7610一直好好的,直到昨天突然变成了走CMNET连接点竟然报告"SymbianOsError -3606"。搞得我想测试手机动态IP之间能否直接用Socket通信都测试不了了。
查询了这个错误号,指的是“KErrGenConnDatabaseDefaultUndefined -3606  "No Internet accounts have been set up. Set up an account in Control panel." ”

后来,终于试出来了,只要到接入点删除拔号连接互联网,就可以了。然后起应用程序,再连接网络时,就能够提示选择接入点了。而之前出现-3606错误的时候,是不会提示接入点选择的。

可能之前我曾经用拨号互联网这个接入点拨号了,导致手机以后连CMNET默认用这个接入点,不带提示的。


posted @ 2005-11-16 15:42 让变化成为计划的一部分 阅读(214) | 评论 (0)编辑 收藏

下面的表格给出了jsr120规定的受限SMS Port Numbers

Port number Description
2805 WAP WTA secure connection-less session service
2923 WAP WTA secure session service
2948 WAP Push connectionless session service (client side)
2949 WAP Push secure connectionless session service (client side)
5502 Service Card reader
5503 Internet access configuration reader
5508 Dynamic Menu Control Protocol
5511 Message Access Protocol
5512 Simple Email Notification
9200 WAP connectionless session service
9201 WAP session service
9202 WAP secure connectionless session service
9203 WAP secure session service
9207 WAP vCal Secure
49996 SyncML OTA configuration
49999 WAP OTA configuration

普通SMS的端口是特定的,可以通过this.getAppProperty("SMS_Port")来获取,只要你的设备支持JSR120。

posted @ 2005-11-16 15:38 让变化成为计划的一部分 阅读(799) | 评论 (0)编辑 收藏

[JavaME]手机是否能够申请到动态IP?

ServerSocketConnection

http://www.j2medev.com/bbs/dispbbs.asp?boardid=21&id=4099&star=1#2083 ,这里是原始讨论贴。

 

这里我们给出一个思路:可以先这样,手机先访问一个固定的网址,然后就会被分配一个IP,这就是手机用来和外界联系的IP了。

Efei说,刚才测试了下,使用一段文档上提供的代码,也就那两三句话

try{
      ServerSocketConnection scs = (ServerSocketConnection) Connector.open("socket://:1234");
      frmMain.append("ip:" + scs.getLocalAddress());
    }
    catch (Exception e) {}

取得了一个IP10.66.7.28

这个IP外部网络是无法访问的,换言之,内部网络可以访问。

所以只要在移动的机房有服务器,你可以访问了

但是还有个问题,这个IP是动态变化的,所以至少需要客户端先访问服务器一下,让服务器知道你现在的IP

确实如efei所说,我在手机上测试结果也是拿到了socket://10.15.134.128:4234,看来是没办法访问的了。但是我觉得虽然我们的位于Internet的服务器无法访问,但是也许另一部手机是可以访问这个地址的,所以手机的p2p理论上也许是可行的。

我的测试代码在http://www.cnblogs.com/Files/zhengyun_ustc/GetDynamicIP.rar下载,安装的jar包在http://www.cnblogs.com/Files/zhengyun_ustc/GetDynamicIP-deployed.rar下载,

Nokia7610测试通过。

朋友们也可以自己在真机上试验下这个程序。

用下面的代码可以得到一个socket 动态IP

 

//Use an unrestricted filter.

String filter = "*";

String url = "socket://:" + m_sSocketPort;

ServerSocketConnection ssc = null;

 

try

{

     //Open the connection.

     ssc =

        (ServerSocketConnection) Connector.open(url);

     System.out.println("/* Already Open the connection!");

       

      //Discover the system-assigned port.

     url = "socket://:" + ssc.getLocalPort();

      //Register the connection now. The AMS will

      //remember the registered URL even when the MIDlet

      //is not active.

     PushRegistry.registerConnection(url,

             m_sMidletClassName, filter);

     System.out.println("/* Already Register the connection now!" +

             url);

      //Now publish the push URL. We can use an HTTP

      //POST or a socket or datagram for this.

     String purl;

     purl = "socket://" + ssc.getLocalAddress() +

        ":" + ssc.getLocalPort();

     publishInboundConnection(purl, m_sMidletClassName);

}

 

 

 

posted @ 2005-11-09 00:27 让变化成为计划的一部分 阅读(366) | 评论 (0)编辑 收藏

     摘要: This article will recount my experiences on a recent project that involved use of the Wireless Messaging API (WMA) and the Push Registry. The Push Registry is a feature new to the MIDP 2.0 spec, and the WMA, while not a MIDP 2.0 feature, is an optional feature that can be found on several MIDP 1.0 and 2.0 phones.
http://www.microjava.com/articles/techtalk/WMA20  阅读全文

posted @ 2005-11-08 17:37 让变化成为计划的一部分 阅读(939) | 评论 (0)编辑 收藏

MIDlet jar signing (a tutorial)

http://www.spindriftpages.net/pebble/dave/2005/06/20/1119275880301.html

I needed to sign a MIDlet and deploy it on a Nokia Series 60 phone (i.e. 6630, 6680 etc) so the user doesn't constantly get security alerts. I figured (hoped?) this might be a fairly simple task since any useful application is likely to need access to restricted functionality. It turns out I was very, very wrong. There is virtually no information on how to sign and deploy an application on the web. Anyway here are the steps I took to get to et my MIDlet signed and installed!

Get required software

1. Get and install the Java SDK (JDK) from Sun (you should already have this)

2. Get and install the Java Wireless Toolkit (WTK) also from Sun

3. Optionally get and install Ant and Antenna to allow you to automate your build

Create and import a certificate

1. You need to use keytool (from the JDK)

2. I used the following command keytool -genkey -alias {myalias} -keyalg RSA -validity 365

3. This will prompt you for a keystore password, enter your keystore password (if you have an existing keystore) or the one you want to use if you don't have one yet

4. Fill in all the prompts about location/company name etc

5. Run keytool -list to see your new certificate

6. Next you must export the certificate so you can import it to your phone

7. Run keytool -export -alias {myalias} -file mycertificate.crt

8. Import the certificate into your phone, in Windows XP SP2 I could do this by right clicking the file and selecting "Send to Bluetooth Device"

Build and package the application

1. Use javac to build your MIDlet paying special attention to your classpath and bootclasspath options (otherwise preverification will fail). I also set target to 1.1 and source to 1.3

2. Generate your JAD file the critical attributes in the JAD are MIDlet-Jar-URL, MIDlet-Jar-Size, MIDlet-Permissions we also included MIDlet-Icon, MicroEdition-Configuration, MicroEdition-Profile, MIDlet-Name, MIDlet-Push-1, MIDlet-Icon, MIDlet-Descriptionn and MIDlet-Version

3. Generate the MANIFEST.MF file based on your JAD, you must remove MIDlet-Jar-Size and MIDlet-Jar-URL

4. Both these tasks can be completed using the wtkJad Antenna task

5. Package and preverify the app using the wtkPackage Antenna Task you must set the classpath and bootclasspath properties correctly otherwise Preverification will fail

Sign the application

1. Sign the Application using jarsigner

2. Run jarsigner -keystore {mykeystore} -storepass (mypassword} {myjar} {myalias}

3. Now you have a signed jar you need to update the MIDlet-Jar-Size in your JAD

4. Now add the certificate to the JAD using JadTool.jar from the WTK

5. Run java -jar JadTool.jar -addcert -alias {myalias} -storepass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

6. Now add the signature to the JAD again using JadTool.jar

7. Run java -jar JadTool.jar -addjarsig -alias {myalias} -jarfile {myjar} -storepass {mypassword} -keypass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

8. You can now deploy this to a webserver with the MIME types set correctly and download it to your phone and it will be a trusted 3rd party application

Tags : jar, signing, nokia, midlets, technology

posted @ 2005-11-08 17:16 让变化成为计划的一部分 阅读(279) | 评论 (0)编辑 收藏

第一,同一个端口是不允许两个程序监听的。
参见注释:
Trying to bind to an already reserved local address causes an IOException to be thrown!
也就是说。调用(MessageConnection)Connector.open("sms://:5000"); 时就会抛出异常。

第二,(MessageConnection)Connector.open监听不同端口是没有问题的。比如http://www.cnblogs.com/Files/zhengyun_ustc/SimplePushRegistry.rar的例子,你就可以看出这一点。在midlet的startApp中,
 protected void startApp() throws MIDletStateChangeException {
  
  if (!init) {
      init = true;
      String[] conns =
        PushRegistry.listConnections(false);
      System.out.println("Found " + conns.length +
        " connections.");
      for(int ccnt=0; ccnt < conns.length; ccnt++){
        DatagramHandler handler =
          new DatagramHandler(conns [ccnt], this);
        connectionHandlers.addElement(handler);
      handler.start();
      }
    }

 }
从而得到所有注册的连接,并转发给线程处理。线程就可以根据所传入的连接名称,自行打开:
   public DatagramHandler(String c, PushSMSListner midlet){
     try {
       dgc = (DatagramConnection)Connector.open(c);
     } catch (IOException x){
         x.printStackTrace();
     }
  
  m_midlet = midlet;
   }

posted @ 2005-11-08 14:08 让变化成为计划的一部分 阅读(619) | 评论 (1)编辑 收藏

     摘要: 一般性的答案是:可以的。只不过现在的手机尚且不支持此标准。

更多的信息:

对于JavaCard这种东西,MIDP2.0中扩展了一个叫做Security and Trust Services API for J2ME (SATSA); JSR 177的东西,具体信息参见http://java.sun.com/products/satsa/。  阅读全文

posted @ 2005-11-08 13:58 让变化成为计划的一部分 阅读(872) | 评论 (0)编辑 收藏

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:

    Also see FAQ-1206

posted @ 2005-11-05 17:37 让变化成为计划的一部分 阅读(399) | 评论 (0)编辑 收藏

     摘要: 本文档并不是一个关于PopupWinks On Mobile 之Kjava版本的开发说明,这里只是一个总入口。我将给出手机传情动漫的奇异特性、用户使用说明,以及演示程序下载地址;并且给出开发指导的相关链接。慢慢看下去,你会大有收获的。
有源代码可以下载研究。  阅读全文

posted @ 2005-11-04 17:32 让变化成为计划的一部分 阅读(1061) | 评论 (0)编辑 收藏

他们真是太棒了!
montagerv1.0
http://www.deviousgelatin.com/montager/image.php
Flickr Montager was created by Billy Fowks | It makes use of the Flickr API

Mappr

Mappr, by Stamen Design

1001

1001 by Adriaan Tijsseling

Panoramio

posted @ 2005-11-01 11:45 让变化成为计划的一部分 阅读(612) | 评论 (0)编辑 收藏

仅列出标题
共4页: 上一页 1 2 3 4 下一页