Download Print this page

Sending An Sms - Motorola A780 Manual To Getting Started

J2me
Hide thumbs Also See for A780:

Advertisement

is.close();
c.close();
Permissions needed:
1. Writing to a file:
FileConnection sc =
(FileConnection)Connector.open("file:///phone/tmp.txt");
OutputStream os = sc.openOutputStream();
os.write(("text to go into the file").getBytes());
os.flush();
os.close();
Permissions needed:
2. Reading a file:
FileConnection sc =
(FileConnection)Connector.open("file:///phone/tmp.txt");
InputStream is = sc.openInputStream();
StringBuffer sofar = new StringBuffer();
byte c;
while ((c = (byte)is.read()) != -1){
sofar.append((char)c);
}
is.close();
Permissions needed:

3. Sending an SMS:

sender = (MessageConnection)Connector.open("sms://");
TextMessage t =
(TextMessage)sender.newMessage(MessageConnection.TEXT_MESSA
GE);
t.setPayloadText(message);
t.setAddress("sms://" + contactNumber);
sender.send(t);
Permissions needed:
4. Listening for an SMS: blah
Permissions needed:
5. Getting GPS location:
LocationProvider loc = LocationProvider.getInstance(null);
loc.setLocationListener(ll,0,-1,-1);
Location location = loc.getLocation(60*3);
javax.microedition.io.Connector.http
com.motorola.file.writeaccess
com.motorola.file.readaccess
javax.wireless.messaging.sms.send
javax.wireless.messaging.sms.receive

Advertisement

loading