sms信息的获得
public List<String> getSms() { Uri mSmsQueryUri = Uri.parse("content://sms/inbox"); List<String> messages = new ArrayList<String>(); Cursor cursor = null; try { cursor = mContentResolver.query(mSmsQueryUri, null, null, null, null); if (cursor == null) { Log.i(TAG, "cursor is null. uri: " + mSmsQueryUri); return messages; } for (boolean hasData = cursor.moveToFirst(); hasData; hasData = cursor.moveToNext()) { final String body = cursor.getString(cursor.getColumnIndexOrThrow("body")); messages.add(body); } } catch (Exception e) { Log.e(TAG, e.getMessage()); } finally { cursor.close(); } return messages; }
?