Is any other property of SMS will also get modify if user read the SMS(from native) excluding "read"?
For e.g.:
int read_status = cur1.getInt(cur1.getColumnIndex("read"));
read_status will become 1 for read SMS.
Please guide me.
The code below will allow you to determine if any other properties besides “read” are changing by printing out the columns and corresponding values for all messages returned by the SMS Content Provider. Based on a quick test that I ran on a Nexus S running Android 4.1.2 JZO54K, it appears that unfortunately, there are no other values that are modified when an SMS changes from an unread to read state.
There is a related “seen” property which may be of interest, though. It changes from 0 to 1 when the SMS has been presented to the user but potentially before the message contents have been read (e.g., when displayed in the summary view of the native Messaging app). The relationship between "seen" and "read" can be further understood by looking through the uses in the com.android.mms.data.Conversation class.
The read state can also be retrieved using the android.telephony.SmsMessage.getStatusOnIcc() method, but that will likely give you the same info that you are already retrieving from the Content Provider. You may want to track the changes to the SMS APIs that Google is indicating will be coming in Android 4.4 (KitKat) since they could help with the problem you are trying to solve, but they could also break your existing implementation if it is relying on hidden APIs / Content Providers.
/* for use within a ContentObserver class; print all messages & fields
from the SMS Content Provider when change to mmssms.db is detected;
not optimized for production use */
public void onChange(boolean selfChange) {
super.onChange(selfChange);
Uri uri = Uri.parse("content://sms/inbox");
Cursor c= getContentResolver().query(uri,null,null,null,null);
if(c.moveToFirst()){
for(int i=0;i<c.getCount();i++){
Log.d(TAG,"======= Message ID "+c.getString(c.getColumnIndexOrThrow("_id")).toString()+" =======");
for (int j=0;j<c.getColumnCount();j++){
Log.d(TAG,c.getColumnName(j)+" = "+c.getString(j));
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With