Mobile Offline Sync - reactjs

I'm currently working on a React Native application, the server is already implemented and my app should implement offline sync, I'm planning to integrate realm on the mobile device to deal with the offline data and pushing the data to the implemented server when the device is online. How would I go about doing that?

I'm trying also to make some kind of offline sync. A calendar app that works offline.
I'm developing it on ionic 4 using sqlite.
Basically, what I did is: I keep a variable with my last update timestamp.
Part 1
Get activities.
A service is running on the background, getting from the backend activities that their creation timestamp is later than the mobile last update timestamp.
Part 2
Every time the user create an activity I add the timestamp to the activities table and a flag called synced that is true / false.
Another service scans the table for synced === 'false' and does the POST request.
Hope I helped.

Related

Electron - How to persist offline data and sync between different app installation

According to this answer, I want to use an offline first db inside my electron app. I nedd that the users are not able to directly modify the database, but they can only read data using the UI. The data needs to be synced with a master remote client app that will add and modify data. Can anyone suggest me a good database library to do this?I have a pusher account and an heroku one, that can be used to pass the data between the clients, but first I need a way to store them into the app

Server for app and website

I am a begginer when it gets to back-end development.
I already have a front and website (html cuss javascript) and I am considering to make an app version of my website.
My website is a multi category blog.
I had a problem of understanding how can I connect a server to my website AND my native app. I know basics of php.
I read articles and q/as , all I could understand is that mobile apps and website use seperate server.
Web server and application server
-- -- is there a way to make a server for both, or is it better to use seperate servers?
-- -- if I use seperate servers for seperate platforms how do I make them show same content without changing it on both servers ( one database for two?)
-- --I heard about a system of creating a main database and a copy of it . Then I sync the copy to the main. How do I do that.
-- -- are there any doc's I can read on this subjects:
1) server for all platforms
(browser,ios app, android app)
2)databse system for seperate servers
From my general experience and the most basic solution, you have a single server in the backend which houses the database as well as the code required to fetch data from the database and supply it.
For example assume that you wrote a function called fetch all users that fetches users from the db and gives back a list of users as its results.
Now irrespective of which platform you are on, you would be able to call that function fetch users and get the data back, if you're on a mobile app, you would need to make an http request to that function, if you're on the web ie, front end you would be making an ajax request. So yes all your code is in one place in the backend. You do not need to make 2 servers for 2 different platforms.
P.S. when you code for the backend use a framework.

How to implement an automatic update of a maintenance page in an angular app?

I have an angular app that queries a Mysql table an then show the records in the page for maintenance. I wanted to automatically update the page whenever the mysql table changes.
One way that i can think of is to poll the db at a certain interval but this seems inefficient. Another way is to publish a topic to aws sns everytime there is an update on the table and then my app can subscribe to the topic so it can trigger the api to retrieve the records from the table from my app.
I was thinking if there is a simpler way of implementing this feature.
Polling would work but its not really a modern way of doing this type of operation. Pushing updates to your angular app from your backend is a better experience. You can do this using websockets to push messages when your database is updated. Your implementation will depend on what your backed language is written in. But here are some links I found to get you started:
How to push notifications with angular.js?
https://blog.pusher.com/making-angular-js-realtime-with-pusher/
AngularJS and WebSockets beyond

ionic realtime database updates

I'm developing a coffee ordering app using ionic and angularJS and I'm using a mysql database with a laravel backend.
Now i want to check whether a certain order has completed or not in real time. Instead of sending $http requests every second to check with the server is there a way to update the app only when the mysql database gets changed in ionic?
I was told pusher.js does the trick but I have no idea how to integrate it with ionic.
Thank you in advanvce
Using socket should be a best solution for real time updates without repetitive requests from front-end. You can use http://socket.io/ on front-end and on PHP backend as mentioned at http://php.net/manual/en/function.socket-create.php.

Corona Mobile App Storage Solutions

I am currently developing a mobile app using the Corona SDK and Lua. I need to store information about each user and load the information for the current user when they load the app. What is the best method to store this information for each user, and how would I get this data on app load. I was thinking about using sqlLite and having a single row for each user. However when the user re loads the app I would have no way of accessing the data for the current user because when the app loads I would need something to index the database. Is there any way I can get some information from the mobile device on app load to index the database? Any ideas or suggestions?
I'm not clear on where the database is stored.
If it's remote on a server just use the device ID
system.getInfo( "deviceID")
If it's local and you have multiple local users then use a login.
You could use a registration process for either instance and store
The registration keys for automatic access when launching the app.
take a look at amazon's services.
like S3,simpleDB, dynamoDB..
Some implementations are already available in Code Exchange
http://developer.anscamobile.com/code/amazon-simpledb-api
http://developer.anscamobile.com/code/amazon-s3-rest-api-implementation-corona

Resources