Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
137 views
in Technique[技术] by (71.8m points)

sql - android - Inserting, Updating, Deleting SMS using ContentResolver

I've got a little problem, using the ContentResolver for inserting, updating and deleting a SMS on my Nexus 5.

I searched a lot and tried everything which was suggested, but my smartphone still does not want to change it's entries in the SMS-database.

My Code for deleting all SMS with a specific address looks like this:

int i = a.getContentResolver().delete(Telephony.Sms.CONTENT_URI,
            Telephony.Sms.ADDRESS + "=?", new String[] { "0820800650" });

The return value is 0, for whatever condition I use. The address exists in database (searched it successfully with query) and the permissions are all in the manifest.

Please help me. I have no clue, what else I could try!

Best regards, Alex Lang


Hi!

Ich hab' ein kleines Problem beim insert, update und delete von ContentResolver auf meinem Nexus 5.

Ich hab' im Netz schon so einige Foren abgeklappert und auch alles Vorschl?ge dort versucht, aber ohne Erfolg.

Meinen Code k?nnt ihr weiter oben sehen.

Der zurückgegebene Wert ist immer 0, egal welche Condition ich verwende. Es existieren SMS mit dieser Adresse (ich habe sie schon erfolgreich mit quere gefunden) und die Permissions sinst auch alle in der Manifest.

Helft mir bitte! Ich wei? nicht, was ich sonst noch ausprobieren k?nnte...

Mit freundlichen Grü?en, Alex Lang

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

On Android 4.4+ -- which your Nexus 5 should be running -- only the user's chosen SMS client will have write access to the SMS ContentProvider.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...