This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add permission Read SMS in android manifest to enable this code to work | |
StringBuilder smsBuilder = new StringBuilder(); | |
final String SMS_URI_INBOX = "content://sms/inbox"; | |
final String SMS_URI_ALL = "content://sms/"; | |
try { | |
Uri uri = Uri.parse(SMS_URI_ALL); | |
String[] projection = new String[] { "_id", "address", "person", "body", "date", "type" }; | |
//retrieving sms for a particular number,you can set to null so as to read all sms in inbox folder | |