mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08:52 +01:00
Delete messages
This commit is contained in:
@@ -5,7 +5,6 @@ import android.app.IntentService;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.moez.QKSMS.common.QKPreferences;
|
import com.moez.QKSMS.common.QKPreferences;
|
||||||
import com.moez.QKSMS.enums.QKPreference;
|
import com.moez.QKSMS.enums.QKPreference;
|
||||||
@@ -56,23 +55,12 @@ public class DeleteOldMessagesService extends IntentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int deleteOldMessages(Context context, String selection, long before) {
|
private int deleteOldMessages(Context context, String selection, long before) {
|
||||||
Cursor cursor = null;
|
|
||||||
selection += " AND " + SmsHelper.COLUMN_DATE + "<=?";
|
selection += " AND " + SmsHelper.COLUMN_DATE + "<=?";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cursor = context.getContentResolver().query(
|
return context.getContentResolver().delete(SmsHelper.SMS_CONTENT_PROVIDER, selection, new String[]{String.valueOf(before)});
|
||||||
SmsHelper.SMS_CONTENT_PROVIDER,
|
|
||||||
new String[]{SmsHelper.COLUMN_ID, SmsHelper.COLUMN_DATE},
|
|
||||||
selection,
|
|
||||||
new String[]{String.valueOf(before)},
|
|
||||||
null);
|
|
||||||
return cursor.getCount();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (cursor != null) {
|
|
||||||
cursor.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user