-2

I would like to implement rollback functionality in android. How to get the previous data when internet is disconnected at the time of parse and inserting data. Thank you for your suggestion in advance.

1 Answers1

0

That isn't rollback. That is called offline data or cached data. Once you have got response store it in the SQLlite DB or file, then next time you have to fetch from the same if network isn't available.

Pr38y
  • 1,565
  • 13
  • 21
  • ok. At second time storing data, if net is disconnected what will happening. The old is removed and new data also not inserting properly. – user3098287 Feb 01 '16 at 10:26
  • You have to code accordingly. Why will you remove old data without getting proper new data ? – Pr38y Feb 01 '16 at 10:29
  • I don't know correctly how to do this. Just i have think like before inserting new data i drop my old table and create new table after that i have insert new values. If i follow the this way for example new data inserting time if our net is disconnect i want retrieve old one. How to do that one. Please give me any suggestion. – user3098287 Feb 02 '16 at 12:17
  • No you don't create new table each time. Check if network connection is available fetch data from server parse it, save in DB with replace_on_conflict flag and update your UI. If network is not available do not make network call, just fetch data from DB, if there is some data update UI. – Pr38y Feb 02 '16 at 12:42
  • actually we are fetching data when click the push notification. If you don't mine can you please give any example for this. – user3098287 Feb 02 '16 at 13:09