Skip to content Skip to sidebar Skip to footer

Reading Text From Sms, And Show It As Text View

I am trying to create app, that will get the text from SMS, and use it in textview. So something like this, message is recived, i check if it is message I want, then i extract text

Solution 1:

First I would listen for SMS incoming, and on incoming SMS show a notification. Then if the user opens your app, update your display using this to get the data you want:

UriallMessage= Uri.parse("content://sms/inbox");
            ContentResolvercr= getContentResolver();
            Cursorc= cr.query(allMessage, null, null, null, null);

            //shows one message
            c.moveToNext();
            //uncomment to cycle thru ALL messages... This will take AWHILE//while (c.moveToNext()) {for(inti=0; i != c.getColumnCount(); i++){


    StringcolumnName= c.getColumnName(i);
                StringcolumnValue= c.getString(i);

                Log.v(TAG, "Col: " + columnName);
                Log.v(TAG, "Val: " + columnValue);
            }

        //}

Play around with it a little. It Should have all of the data you need (distinguish SMSs by timestamp)

Post a Comment for "Reading Text From Sms, And Show It As Text View"