Sqllite for data/Json Object Caching?


#1

I am new to angular and am still in a learning phase. So , basically i have tons of doubt’s. Still i am using ionic because it just eases the work and am totally interested in learning it.

Before the doubt’s let me explain what i want to achieve.

AIM

  • Sending data to php file and receiving JSON object from the same request.
  • Using that JSON data to populate a list and make it available even when not connected to Internet( caching that object ).
  • Updating the cached data like if updated json object is received.
  • Backgound geolocation to track even when app is not active. i came accross background geo ngcordova plugin but i need basic example to understand and want to know whether if i use backgrn geo plugin , will i need separate regular geolocation implementation when app is running?( Not reached that point but still its a future requirement).

what i achieved so far

  • i am able to get json object from a php file but not sending data to it.

  • populated the list with json data but it needs caching to be implemented.

Doubts

  • I have only one object to be cached so can i achieve that without using any database ? that single record can have many records so i think local storage is not an option(5 MB limit).
  • If i use sqlite how to sync the updated json object with existing sql tables?
  • I dont think pouch db is an option because i already have a database which is also used for a website.
  • On getting parameters from background geolocation and firing a local notification how to decide what page of app will open when user clicks the notification?

I am really confused about the workflow and code structure of the angular to follow to achieve this.

Confusion about in which service/controller should backgrond geo be implemented ?

where to open the db (if i use it) and in what service to sync it ?

how to use sql data to populate the list?



I am not expecting answer for all this doubts lol :joy: :stuck_out_tongue_closed_eyes: but atleast a guidance or suggestions on any of the topic above on how to proceed. code templates will be a big help.

SORRY FOR BEING A NOOB


#2

Well that’s a big object, it could take long to fetch it from your php server exposing your app to timeouts and disconnections, I would consider incremental fetching if it does apply to your domain.


#3

Thanks for the reply @gmarziou Do you mean making multple http calls everytime required ?


#4

Now I came accross Firebase

So to sync my websites sql data with firebase i am thinking of doing this:

  • Every time from website when table entry is done at the same time i will insert that data to firebase using php-firebase.
  • Then in my app i will just sync that data with firebase.

is this feasible ? has anyone tried doing something like this ?