android - Insert SMS in Database in Lollipop -


In my app, I need to add some SMS to the Android messaging database.

My code is basically the next:

  public static Boolean addMessage () {ContentValues ​​cv = new ContentValues ​​(); Cv.put (Sms.ADDRESS, "99912345"); CV.Put (SMS.BDY, "test message"); Cv.put (Sms.DATE, System.currentTimeMillis ()); Cv.put (Sms.DATE_SENT, System.currentTimeMillis () - 10 * DateUtils.MINUTE_IN_MILLIS); CVP (SMS .rd, 0); Uri U = context.gate content resistor (). Insert (SMS.inbox CONTRAINSURI, CV); Come back! = Null; }  

and I have declared related permissions in the manifest:

  Android: use = & Android: name = "android.permission READ_SMS "/> & Lt; Usage-permission Android: name = "android.permission.WRITE_SMS" />  

When I execute the function, always insert

content: // SMS / Inbox / 0

And the SMS is not on the database. Logcat does not show anything special.

My OS version is Android 5.0.2

I edit my question ...

There is no more than 19 SMS in versions of Android It is possible to use the standard (and potentially informal) APIs to update the database, adding the root permissions for your app to update the database manually using commands like the commands given in this article. I want to:

if I I use this command to do, what I can force the telephony provider to load it again after the database is updated?

Thanks again!


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -