Consultation about ionic and bd without internet

0

My query is the following one, I want to make an app in ionic that allows to send reports of x type to a server rest, well the server works with a bd mongo, here once I have the reports I can do anything, but that happens if the android device where the app is installed does not have internet, I was thinking that I should use a bd in the same android (I'm relatively new in android, I do not know if this is possible, if so it would be better postgress, or recommend), following, then it should have as a variable to check the status of the internet at all times, this could be programmed in a function, as ionic uses angular I was thinking that in an initialization function maybe ..., then save this information offline in the bd, and when there is internet send these reports that could not be sent for not having interne (this would handle with crons?), these are all my doubts about this subject, I would appreciate the help that can you give me.

    
asked by Kevin AB 09.12.2016 в 04:19
source

1 answer

1

It occurs to me that you could use SQLite, to save your data and thus access it offline. There is the Cordova plugin that works with Ionic. link

Depending on the version of Ionic you use, you could use Ionic-native for the plugins.

On the other hand, as you mention yourself. You could perform a function with the $ timeout service of angular, to check the connection status of the phone, every certain period of time.

Please note that to be able to know the status of the Wi-Fi connection for example, you will also have to use another plugin from Cordova that allows you to see the status of the different connections: link

    
answered by 16.12.2016 в 20:45