Search code examples
androidemailtimersmsandroid-contentprovider

How to Recognise that which message has sent in android?


Sorry for any mistake! I am developing an App in android in which I am access unread message from the mobile with the help of Content Resolver & Sending those message on Email automatically. I am using TimerTask for this which repeate my Application with in a specific Time which I have set. Now it again Pickup those message which I have send On Email. Now problem is that How to recognise which message i have send in android? Any help will be appreciated. Thanks & Regards, Deepanker Chaudhary


Solution

  • There are a few solutions to this:

    1. Store the timestamp/id of the last SMS successfully forwarded through the email in a SharedPreferences value.
    2. Maintain a database internal to your application and store all the messages forwarded to email along with their sending status in this database, so that you can resend the message in case of error in sending the email. You may have to perform housekeeping of this database to occasionally clear out past entries.