i wrote the simple code
ContentResolver contentResolver = this.getContentResolver();
Uri uriSMSURI = Uri.parse("content://sms/");
// HERE I GET THE EXCEPTION
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null, null);
int count = cur.getCount();
I get an exception about Permission Denial in the third line.
How can i get the Permission ? how can i access the messages ?
If you want to read SMS you have to specify the
READ_SMSpermission in your manifest like below…The default behavior for Android is to exception an application that tries to access facets of the system that it has not explicitly requested access to, this is to protect the user from malicious software.