Android: text message marking (SMS) unread

For some reason, the NO sms app on an Android phone seems to offer the most basic function (that is, even old dumb phones) for marking an unread SMS message.

I believe that I am writing such an application myself, but before starting, I would like to know a little about how to do it and why it was not done before. Is it really impossible?

+4
source share
3 answers

NOTE. . Firstly, just to let you know that Android has little to do with the messaging system in Android (2.3 or lower), because to work with things like SMS, you need a request using Content Providers that is officially unavailable, and Android guys also warned about this. You can check this at the following URL: http://android-developers.blogspot.in/2010/05/be-careful-with-content-providers.html

Further, for your solution and for all interested parties, I would like to share my explanation in accordance with the Android OS versions:

- Version 2.3 or lower: Yes, the application is as simple as being guided by Pankaj Kumar , and it will work for the above version of the Android OS and below.

- Version 4.0 and higher: The application will fail and will not work . Yes, as Android Dev Guys warns, from this version and above you won’t be able to read the contents of the messages, since I tried this to prevent your application from working in future Android releases. You can only get numbers from them, for example: inbox, sent, outbox failed, etc., but you cannot change or read the contents.

- Version> 3.0 and <4.0: Never tested or tried.

We hope that this information will help you and save your time to go to a dead end :)))

+2
source

Here you go

The SMS database has the following columns

06-19 17:41:19.723: V/vipul(25223): _id 06-19 17:41:19.723: V/vipul(25223): thread_id 06-19 17:41:19.723: V/vipul(25223): address 06-19 17:41:19.723: V/vipul(25223): person 06-19 17:41:19.723: V/vipul(25223): date 06-19 17:41:19.723: V/vipul(25223): protocol 06-19 17:41:19.723: V/vipul(25223): read 06-19 17:41:19.723: V/vipul(25223): status 06-19 17:41:19.723: V/vipul(25223): type 06-19 17:41:19.723: V/vipul(25223): reply_path_present 06-19 17:41:19.723: V/vipul(25223): subject 06-19 17:41:19.723: V/vipul(25223): body 06-19 17:41:19.723: V/vipul(25223): service_center 06-19 17:41:19.723: V/vipul(25223): locked 06-19 17:41:19.723: V/vipul(25223): error_code 06-19 17:41:19.723: V/vipul(25223): seen 06-19 17:41:19.723: V/vipul(25223): deletable 06-19 17:41:19.723: V/vipul(25223): hidden 06-19 17:41:19.723: V/vipul(25223): group_id 06-19 17:41:19.723: V/vipul(25223): group_type 06-19 17:41:19.723: V/vipul(25223): delivery_date 06-19 17:41:19.723: V/vipul(25223): date_sent 

Below the fragment all SMS are marked as unread, you can match it with the identifier and only make unread that SMS

 package org.vipul; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.util.Log; public class SMSSampleActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Uri uri = Uri.parse("content://sms/inbox"); Cursor cursor = managedQuery(uri, null, null, null, null); for (int i = 0; i < cursor.getColumnCount(); i++) { Log.i("vipul", cursor.getColumnName(i)); } if (cursor.moveToFirst()) { do { String id = cursor.getString(0); ContentValues contentValues = new ContentValues(); contentValues.put("read", false); getContentResolver().update(uri, contentValues, "_id=?", new String[] { id }); contentValues.clear(); } while (cursor.moveToNext()); } } } 

Finally add android.permission.READ_SMS ans android.permission.WRITE_SMS in the manifest

+1
source

There is an app called Mark as Unread published by Christian Asbjørn Skogsberg (check it out), so I think it’s possible.

0
source

All Articles