Sms doesn't save on Kitkat 4.4

后端 未结 1 1564
孤城傲影
孤城傲影 2020-12-04 01:25

My Sms app does not save the sms to the device even though I already set it as the default messaging. I need to support android pre-kitkat so I did a bit researching and had

相关标签:
1条回答
  • 2020-12-04 01:48

    The default SMS app is responsible for writing all incoming messages to the Provider. Even though you've implemented a Receiver for your app to read the message from the SMS_RECEIVED broadcast, you still need to actually write the message to the Provider. For example:

    ContentValues values = new ContentValues();
    values.put(Sms.ADDRESS, address);
    values.put(Sms.BODY, smsBody);
    context.getContentResolver().insert(Sms.CONTENT_URI, values);
    
    0 讨论(0)
提交回复
热议问题