Delete sms

i tried this pluging on android 4.1.2 and the delete failed !!! any help ?? the listSMS worked fine that mean the plugin is ok , but the delete do nothing.

$scope.delete = function(id) {

console.log("id = " + id);
if(SMS) SMS.deleteSMS({
_id : id
}, function( n ){
console.log( n + ’ sms messages deleted’ );
}, function(err){
console.log('error delete sms: ’ + err);

any help ?

update: the error i get

java.lang.IllegalArgumentException: Uknown URL

read the github issue you have posted to and the other issues.

Maybe your smartphone has special restrictions even in 4.1.2 (some manufacturer have own custom android versions with other and restricted functionalities).

Seems the plugin is not well supported anymore and you will get problems in the near future, because there are only devices with android >=4.4.

my device is samsung note 1 !!

what is set to your id-parameter?

the sms id , i check it , i set console.log(JSON.stringify(data)); and the id is correct = _id

if i follow the Java code of the delete function:

There are these lines:

String uri_filter = filter.has(BOX) ? filter.optString(BOX) : "inbox";
int fid = filter.has("_id") ? filter.optInt("_id") : -1;

then this

Uri uri = Uri.parse((SMS_URI_ALL + uri_filter));
int id = cur.getInt(cur.getColumnIndex("_id"));

and this

ctx.getContentResolver().delete(uri, "_id=" + id, (String[])null);

So maybe the uri is not set correctly or the id failed.

i think

Uri.parse((SMS_URI_ALL + uri_filter)) is failing..

ok i will check it now, thanks

how to use the java file insted of the .jar ?

you can’t… .java is only the source code and the jar-file is the final compiled code to an executable file.
So you need to compile the file first and then you can replace it.

You can change in SMSPlugin.jav this line:

ctx.getContentResolver().delete(uri, “_id=” + id, (String[])null);


ctx.getContentResolver().delete(Uri.parse(“content://sms/” + id),null, (String[])null);