android - Inserting, Updating, Deleting SMS using ContentResolver

一世执手 提交于 2019-12-16 18:06:08

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/24410154/android-inserting-updating-deleting-sms-using-contentresolver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!