mardi 22 décembre 2015

mms-sms thread content on samsung devices

i have been working on a Sms-Mms messaging app for android for a while now as my first project for android platform. i have seen that the standard uri wont work in some cases on samsung devices. i am using the following code to get both mms and sms in a thread for non-samsung devices. but it wont work on my Galaxy s6 edge. is there a workaround for this? i have seen in a post on stackoverflow that i can get two cursors for sms and mms individually and then join them and get a sorted cursor but that has performance issues, i wonder how apps like go-sms do it. any help will be appreciated a lot :)

ContentResolver contentResolver = getContentResolver();
    final String[] projection = new String[]{Telephony.TextBasedSmsColumns.BODY+" as "+Telephony.TextBasedSmsColumns.BODY};
    Uri uri=Telephony.MmsSms.CONTENT_URI; 
    Cursor query = contentResolver.query(uri, projection, Telephony.TextBasedSmsColumns.THREAD_ID+"="+thread_id, null, null);
    query.moveToFirst();
    Toast.makeText(getApplicationContext(),query.getString(0),Toast.LENGTH_LONG).show();

Aucun commentaire:

Enregistrer un commentaire