Motorola E680 Technical Manual - Page 58
Setting of MessageListener and receiving of notifications about incoming, messages
View all Motorola E680 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 58 highlights
byte[] newBin = new byte[size]; for (int i = 0; i < size; i++) { nextByte = (rand.nextInt()); newBin[i] = (byte)nextByte; if ((size > 4) && (i == size / 2)) { newBin[i-1] = 0x1b; newBin[i] = 0x7f; } } return newBin; } byte[] newBin = createBinary(msgLength); binMsg.setPayloadData(newBin); int num = connClient.numberOfSegments(binMsg); Setting of MessageListener and receiving of notifications about incoming messages: public class JSR120Sample1 extends MIDlet implements CommandListener { ... JSR120Sample1Listener listener = new JSR120Sample1Listener(); ... // open connection messageConnection = (MessageConnection)Connector.open("sms://:9532"); ... // create message to send ... listener.run(); ... // set payload for the message to send ... // set address for the message to send messageToSend.setAddress("sms://+18473297274:9532"); ... // send message (via invocation of 'send' method) ... // set address for the message to receive receivedMessage.setAddress("sms://:9532"); ... // receive message (via invocation of 'receive' method) ... class JSR120Sample1Listener implements MessageListener, 58