react native - store object on device and upload on internet reconnection - javascript

I’ve looked at the storage api’s for both react-native and expo and I’m struggling to find a suitable way to structure my app.
I’ve made an app for my workplace in which we scan equipment and record the data. At the moment I’m using firebase to upload the data and store on their servers.
My boss has asked whether we can implement a way of storing the data locally if the user has no access to wifi and then upload the data upon internet reconnection.
I’m not sure where to start with this. I understand that I can use NetInfo and add an event listener to monitor the connection. However I’m not sure how I would persist any scanned data with the opening and closing of the app and such.
If anyone could help point me in the right direction, it would be greatly appreciated it.
Thanks

Related

How to create a login system that stores user data for beginners?

I'm working on my first web app using ReactJs and have the frontend pretty much done. Now I want to be able to pair the user's data with their username so next time they log in, everything will be exactly as they left it. The user's data is currently all in a JavaScript object so I think I want to save it as a json file. However, I have no clue how to even start this.
My first issue comes with creating the login system. Obviously I cannot just store the username and password in plain text so I would need to encrypt and decrypt it somehow. However, I am currently hosting my site on Netlify so I would need to pass that information over there somehow and the only way I can think of is by adding it to my GitHub repo which is public so anyone can then see my encryption algorithm.
I'm not even sure if this is even how you do it since I've never done anything like this before. Does anyone know where I should start? I don't need something super sophisticated just reasonable.
Probably you can use google's firebase and firestore services. They have an amazing documentation on their website too and there's plenty of resources online. google for firebase authentication tutorial and you'll find a whole lot.

PWA - How to send push notifications to all subscribed users

I would like to set up a notifications system to be used when a new update of my progressive web app is available.
The pwa uses react and has node (with express) as the backend.
I followed google's guide to push notifications (link) and everything works fine when sending a push message from the devTools' service workers tab.
The problem is that the guide ends there and i would like to be able to send a notification to every subscribed user.
I tried to look for a solution and i found out that Firebase Cloud Messaging could do what i need, but when i tried to implement it i got a bit confused as it seems quite different from what I've done in the guide mentioned above.
I've also looked at other guides here and there but they don't do what i need and some of them doesn't even work.
Can someone please explain me what should i do the get that result?
Thanks in advance for the help, i hope my question isn't too stupid '^^

Send Push Notification from Web Application using AWS PinPoint

I have a react web application that assigns tickets and a react-native app for user to see their assigned tickets. I want to be able to send a push notification to the user when they are assigned a ticket. I'm looking through PinPoint JavaScript SDK, but having trouble seeing if I can do it. Has anyone been able to accomplish this?
I was able to accomplish this. You use AWS Amplify Analytics to put UserId or any attribute you want to be associated with a user. Then Use Pinpoint SDK to createSegment which attributes target the ones associated with the user. Then Pinpoint SDK to createCampaign for created segment. Hope this helps.

How to store data on an iOS web app?

I'm currently working on a planning app, and I've ran into an issue. I can't find a way to store data without it being lost after restarting the app. I've tried cookies, window.name (despite the fact that that shouldn't even work to begin with), but neither of those work. The tasks (planned tasks) will be stored on the server, but seeing it's per person, having in input field for login everytime you start the app doesn't seem like the best plan. Any suggestions?

how to show real time data to all users using react and firebase?

I am building a messaging app that updates in realtime. So far I can log in with google and post a message and then that message displays on screen. however, if I log in via another google account (the app is hosted on heroku) and post a message as userB then userA won't see this message on their screen until they refresh the page. what is the best way to update all screens in real time so people can actually have a conversation in real time.
every message is posted and stored in the firebase. my only solution so far requires using the javascript setInterval method and pulling from the database every 3-5 seconds. this worked however it caused the app to become very slow and laggy and a poor experience. any pointers/tips are welcomed
You are using the Firebase and its one of the main feature is the real-time database. Firebase will automatically let you know if there is any change in your JSON database. You no need to send the request in interval basic.
You can refer Zero to App: Develop with Firebase - Google I/O 2016 It is also a messaging app demo by the Google Guys.
You can find the sample source code in Github to send and receive the message in real-time.
There are a lot of ways to do this. Generally, you will want to be notified by the server once a new message has come in and not have to ping the server every X seconds.
You could look at these:
socket.io and learn about websockets in general
A nice list of existing chat apps that utilize react
Google's cloud messaging, as you already use firebase, this might be the way to go for you here.
This should lead you in the right direction.

Categories

Resources