Java ME Developer Guide

Chapter 22 - Network APIs

public class regThread extends Thread{

public void run(){

try {

long delay = Integer.parseInt(tf.getString()) * 1000;

long curTime = (new Date()).getTime();

System.out.println(curTime + delay);

PushRegistry.registerAlarm("WakeUp", curTime + delay); mainForm.append("Alarm registered successfully");

}catch (NumberFormatException nfe) { mainForm.append("FAILED\nCan not decode delay " + nfe);

}catch (ClassNotFoundException cnfe) { mainForm.append("FAILED\nregisterAlarm thrown " + cnfe);

}catch (ConnectionNotFoundException cnfe) { mainForm.append("FAILED\nregisterAlarm thrown " + cnfe);

}

}

}

}

SMS_send.java

import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import javax.microedition.io.PushRegistry; import javax.wireless.messaging.*; import javax.microedition.io.*;

public class SMS_send extends MIDlet implements CommandListener{

public Display display;

public static Form messageForm; public static Form mainForm;

public static Command exitCommand;

DRAFT - Subject to Change [163/201]

Page 163
Image 163
Motorola maxx V6 manual Draft Subject to Change 163/201, SMSsend.java