0

I'm living in area where the internet connection would randomly online / offline. To ensure the smoothness of the business that my app currently supporting, I took the route where I would send its submission data straight to the server online if the device online at the submission time, but I'd save the data to sqlite, if the device goes offline at the submission time. Then, the app will automatically send the data online to server when the device goes online later

How do I achieve this? Should I make a service that would constantly check for internet connection if saved submission data exists? Or is there more proper and better way? Thank you.

MeApt
  • 11
  • 2
  • 2
    Does this answer your question? [how to send data to server from android when no internet is available](https://stackoverflow.com/questions/26360034/how-to-send-data-to-server-from-android-when-no-internet-is-available) – aryanknp Sep 25 '20 at 05:49

1 Answers1

0

You need to add broadcastreciever for internet connection. When internet is available, you need the service which will check if there is any local data available and send it to the server. for service, i will highly recommend the work manager. You can follow this site for understanding the work manager: https://developer.android.com/topic/libraries/architecture/workmanager/basics

Saad Khan
  • 180
  • 2
  • 12