0
我想读取收到的文本消息(SMS),只要他们到达(在收到广播 - android.provider.Telephony.SMS_RECEIVED)。我实际上使用下面的代码,但它只在收到之前读取消息。任何人都知道为什么?应用程序读取错误的短信
public String getLastSms() {
resolver = context.getContentResolver();
uri = Uri.parse("content://sms/inbox");
projection = new String[]{"body"};
selection = null;
selectionArgs = null;
sortOrder = null;
cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
cursor.moveToFirst();
return cursor.getString(0);
}
其实,你的链接帮助了我。非常感谢你。 – rootpanthera 2013-05-14 11:32:59