, :
Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);
if (cursor.moveToFirst()) {
do {
String msgData = "";
for(int idx=0;idx<cursor.getColumnCount();idx++)
{
msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
}
} while (cursor.moveToNext());
} else {
}
This code will save all message data as a string in a variable msgData. Then you can search inside the phone number of your target sender, information about your application, etc. To implement this strategy, you just need to call the above code when you first start the application. Please note that you also need to add permission: android.permission.READ_SMSif you have not already done so.
source
share