Answer the question
In order to leave comments, you need to log in
Programming for Android. Interception of incoming SMS
Hello, dear Habra community! I recently decided to try my hand at programming for Android. I am writing an application, the essence of which is that it intercepts all incoming messages and if any message satisfies certain conditions, then it is immediately deleted.
After intercepting the message, I have an instance of SmsMessage. I am trying to remove it like this:
Uri deleteUri = Uri.parse("content://sms");
context.getContentResolver().delete(
deleteUri,
"address=? and date=?",
new String[] {sms.getOriginatingAddress(), String.valueOf(sms.getTimestampMillis())});
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(uriSms, null,null,null,null);
while (c.moveToNext())
{
String body = c.getString(c.getColumnIndex("body"));
long data = c.getLong(c.getColumnIndex("date"));
String address = c.getString(c.getColumnIndex("address"));
}
c.close();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question