Find datamessage on android phone from before application was installed

Let's say I have an application that sends a datamessage using this method.

    smsManager.sendDataMessage(String destinationAddress, String scAddress, short destinationPort,
  byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent);

say that the person who sent it has an application, and the person receiving it has no application, if the person who did not have the application has the application installed, there is a way to look in the system for this message data to confirm the personโ€™s phone number who originally sent it

+4
source share
3 answers

... if a person who did not have the application installed the application, there is a way to search the system for this data message ...

, . , . SMS . .

+2

. , sms, , . . , , , .

0

, :

// public static final String INBOX = "content://sms/inbox";
// public static final String SENT = "content://sms/sent";
// public static final String DRAFT = "content://sms/draft";
Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);

if (cursor.moveToFirst()) { // must check the result to prevent exception
    do {
       String msgData = "";
       for(int idx=0;idx<cursor.getColumnCount();idx++)
       {
           msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
       }
       // use msgData
    } while (cursor.moveToNext());
} else {
   // empty box, no SMS
}

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.

-1
source

Source: https://habr.com/ru/post/1607158/


All Articles