Hi everyone I've found this thread relating on how to retrieve sms data in my phone:
How can I read SMS messages from the device programmatically in Android?
I did follow what they show as answer, I can now read all the sms I've received but my problem is that i cannot see my own replies to thoses sms.
Can anyone provide a way to see my own text sms in the conversations?
For info my code:
public class MainActivity extends AppCompatActivity {
RecyclerView rv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String myDate = "2021/06/07 00:10:45";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = null;
try {
date = sdf.parse(myDate);
} catch (ParseException e) {
e.printStackTrace();
}
long millis = date.getTime();
int REQUEST_PHONE_CALL = 1;
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_SMS}, REQUEST_PHONE_CALL);
}
Log.i("debug", "intro");
// Create Inbox box URI
Uri inboxURI = Uri.parse("content://sms/inbox");
// List required columns
String[] reqCols = new String[]{"_id", "date", "body"};
// Get Content Resolver object, which will deal with Content Provider
ContentResolver cr = getContentResolver();
// Fetch Inbox SMS Message from Built-in Content Provider
Cursor c = cr.query(inboxURI, reqCols, "date>="+String.valueOf(millis), null, null);
DatabaseUtils.dumpCursor(c);
}