Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
More
Next Blog
Create Blog
Sign In
Ads by Google
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;
Android LED
Notification
Android RTP Sender &
VLC Receiv er
Audio Record&Play
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView view = new TextView(this);
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
String sms = "";
while (cur.moveToNext()) {
sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
}
view.setText(sms);
setContentView(view);
}
Follow ers
36 comments :
Krishna February 1 5, 2 01 1 at 1 0:4 4 AM
Hi
Nice tutorial sav e m y tim e .But i hav e one question how we read the new incom ing m essage.I want to read the
new incom ing m essages any idea about this
Reply
Replies
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
1/6
14/07/2015
SIVA August 1 3 , 2 01 1 at 9 :3 1 AM
Setup the Android Manifest with the perm ission and the Intent Receiv er
android.app.NotificationManager;
android.content.Context;
android.content.Intent;
android.content.IntentReceiv er;
android.os.Bundle;
android.prov ider.Telephony ;
android.util.Log;
android.telephony .gsm .Sm sMessage;
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
2/6
14/07/2015
dungcrx February 5, 2 01 2 at 1 1 :3 5 PM
hi ev ery body
i am working m y project.When hav e an incom ing phone call, the screen has not changed its.How to do it (can
som ebody giv e m e a little code for this problem ) ? please help m e!
Reply
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
3/6
14/07/2015
user
1 004 5
nor
current
process
has
Reply
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
4/6
14/07/2015
return v ;
}
public v oid onActiv ity Result(int requestCode, int resultCode, Intent data) {
try {
// if (resultCode = = Activ ity .RESULT_OK) {
Uri ur = data.getData();
Cursor c = getActiv ity ().getContentResolv er().query (ur, null, null,
null, null);
if (c.m ov eToFirst()) {
String s = c
.getString(c
.getColum nIndex("body "));
Sy stem .out.println(s);
Toast.m akeText(getActiv ity (), s, Toast.LENGTH_LONG).show();
sm sDisplay .setText(s);
}
}catch(Exception e){
e.printStackTrace();
}
// }
}
}
It opens a Inbox like when I open original sm s app in anroid, but when I click on one m essage it doesnt copy body of
that sm s in m y edittext. Please couul y ou look at m y code and find m istake?
Thanks a lot for y our tim e
Reply
I want to m ake a app like whatsapp plz help . all data let say com m unication , m essaging , status
Thanks
Reply
Appzuniverse April 1 7 , 2 01 4 at 2 :4 8 AM
Wow, finally i got good code, it was worked well, i had searching m any sites about this code, Thanks for sharing,
keep updating
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
5/6
14/07/2015
Comment as:
Publish
Google Account
Preview
Newer Post
Hom e
Powered by Blogger.
http://androidsourcecode.blogspot.in/2010/10/android-reading-inbox-sms.html
6/6