为什么下面的代码会冻结手机上的所有操作?该应用程序读取传入的短信,但该应用程序没有打开。单击应用程序后,手机立即冻结。我究竟做错了什么。我将不胜感激任何帮助。
try {
//A DatagramConnection is created to listen for any incoming sms's.
DatagramConnection _dc =
(DatagramConnection)Connector.open("sms://");
Datagram d = _dc.newDatagram(_dc.getMaximumLength());
_dc.receive(d);
byte[] bytes = d.getData();
String address = d.getAddress(); //The address of the sms is put on a string.
String msg = new String(bytes); //The body of the sms is put on a string.
} catch (Exception me) {
}