诺基亚 S40 推送注册表



我正在构建一个虚拟应用程序以查看它如何工作推送注册表警报,但我没有让它工作。当我运行它时,我什么也没看到...

知道吗?

这是我的代码(带有SDK 2.0,S40的LWUIT)

package mobileapplication2;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.PushRegistry;
import javax.microedition.midlet.*;
/**
 * @author S40
 */
public class Midlet extends MIDlet implements Runnable {
    public Midlet() {
        Display.init(this);
    }
    public void startApp() {
        Display.getInstance().callSerially(this);
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
    public void run() {
        try {
            PushRegistry.registerAlarm(getClass().getName(), System.currentTimeMillis() + 100000);
            Form f = new Form("Example");
            f.addComponent(new Label("HOLA"));
            f.show();
        } catch (ClassNotFoundException ex) {
            System.out.println("NOT FOUND");
            ex.printStackTrace();
        } catch (ConnectionNotFoundException ex) {
            System.out.println("CONNECTION");
            ex.printStackTrace();
        }
    }
}

我终于让它工作了

如果你想

看一下,这是我的最终代码

            java.util.Calendar cal = Calendar.getInstance();
            cal.setTimeZone(TimeZone.getTimeZone("GMT"));
            cal.set(Calendar.MONTH, Calendar.NOVEMBER);
            cal.set(Calendar.DAY_OF_MONTH, 18);
            cal.set(Calendar.AM_PM, Calendar.PM);
            cal.set(Calendar.HOUR_OF_DAY, 15);
            cal.set(Calendar.MINUTE, 27);
            cal.set(Calendar.SECOND, 0);
            System.out.println("CALE " + cal.getTime().toString());
            Date d = new Date();
            long l = PushRegistry.registerAlarm(getClass().getName(), cal.getTime().getTime());

相关内容

  • 没有找到相关文章

最新更新