Android, API Server, and Firebase Database relation - android

So I have a project that I'm making which is An Android Application, which takes provides information taken from API Server (Laravel 5.x) and also provides live-chat feature
What I'm not sure of doing is how to handle the live-chat feature. Currently here's how the chat system works (keep in mind, there is also a Web App which provides the same feature, that I'm willing to change) :
User type chat and sends it. The client (Android app or Web App) sends it to the API Server. which then saves it to the database.
Then the API Server (which is connected to mysql database server) sends in email / notification which based on the other user's configuration.
When the other User opens the chat, it will call the API Server (which is connected to mysql database server) asking if there's an update every 3 seconds.
if there is, then (Android App or Web App) will show the new chat.
Now first of all I know that this is not efficient, bad on performance, etc.
Now I want to try and use firebase database for realtime chat.
Now, I really want to use the API Server for logging and storing Chat info inside my own database because of some legacy Android App which takes a long time to work on.
which is the better scenario :
The Android App directly sends new chat information to Firebase Database
The Android App sends new chat information to API Server. Then the API Server sends it to Firebase Database
Is there a better way to do this
so which is the better way to do this?

I would highly recommend using the firebase firestore. It sounds like it would solve the best of both worlds. Nosql json storage format is great for a chat app. Also the data is "live" so it will loosen for a change and update the user sides data. Saving you the 3 sec call resources. Last I checked it was still in beta but I used it top make an app that lets you create plus and live pools and it wad pretty smooth. It does take a bit to wrap your head around though.

Related

android send data to device?

we have an application under xamarin where a user connected and on a login the user DOWNLOAD the work he make it.
Device call our web service and device downloaded the datas in json format.
The data downloaded are saved into the database sql lite on client.
All work fine.
Now imagine this sample :
user has connected on the device, downloaded work.
But afer some hours, the work has changed for some reason.
We need to send new data (new work) again the particular device.
I've read some article about the google push notification but i wonder if i search on the right place.
How i can send data to a particular device under android ?
Could you share your experience, article , sample..
Thanks for your knowledge
I've read some article about the google push notification but i wonder if i search on the right place.
There is a realtime database on Firebase that will fit your requirement. But it is a cloud based service, using it probably means you have to move all your data from your server to Firebase server. So it is not a good fit, if you want to use your own webservice.
Other option is to use an AlarmManager to set a repeating task to sync your data periodically.

Sync data between Android App, Web and Desktop application

Currently, I have an App that sends data to web server.
But, if website sends data to the server, my App does not receive any data from the server.
I want to create an app like Evernote where I don't have to refresh the app to receive data from the server.
So when I sends data from mobile, it has to sync with all other devices.
How do I implement it?? Which method is best for android?
Is GCM the only way to do it?
We need more information regarding what you have tried implementing for us to provide a better solution since your issue is about code implementation.
You may check Firebase Realtime Database as this seems perfect for your situation because with Firebase, "data are synced across all clients in realtime, and remains available when your app goes offline". Since you are using Android, you can check this document: Set up Firebase Realtime Database for Android.

Two Android apps + web app sharing one Firebase db

I have 2 android apps and a web app catering two user groups,
android app + web app for mostly writing data to the database
another android app for retrieving these data
I need my applications connected to the same database, I want to know whether this is possible with Firebase and is considered valid.
I've seen older posts with workarounds but I need to know whether the new Firebase version supports this out of the box.
This is my first time trying to integrate Firebase into one of my projects therefore some guidance on achieving this task would be really useful.
Thanks!
As long as I can remember Firebase supported this even before the "new Firebase 2.0". Following just an excerpt taken of the Realtime Database feature list:
A cloud-hosted NoSQL database. Data is stored as JSON, synced across
connected devices in milliseconds, and available when your app goes
offline.
Accessible directly from client SDKs, or from your server with the REST API
tl;dr
That's totally possible with Firebase.

Android 2-way sync-ing approach

I'm developing an app which list the shops around my area by category. I have a REST API where the results would be returned in paginated mode (page=2, limit=20 etc) and users will need to login to the app in order to view the listing.
I'm thinking to incorporate offline 2 way sync into my app. The moment when user logs in for the first time he has to be connected to the internet and subsequently once he has logged in he should be able to proceed straight to the main screen eventhough the app is offline.
User also has the ability to post a review offline in which I suppose we should cache the post request in the DB and listen to network state changed event? Once there's a network then query everything in the cache and send to the server.
I understand how this can be achieved at high level but I'm still new to Android and not exposed to the popular libraries out there. Just wondering is there any library that is already doing all the magic for me?
I stumble across Sync Adapter and Content Provider but it seems like they are quite complicated to a beginner. Is there a simpler library that can achieve similar results?
Also from my understanding the way how it works would be.. there will be a service that periodically poll server for changes - and fetch when there's any then store into SQLite. On poll it will also retrieve client changes and send to server. When user views listing the app will retrieve from SQLite instead making request to the server - there is no direct interfacing between the App and server. Can anyone verify if my understanding is correct?

How to sync android database with web database?

Hi I want to sync android database with web database, my scenario is:
I want to make an android app dictionary. The dictionary words are added by web forms and the user android consume those words. In the Android application I have the historical of words that the user displayed and data of their studies, that should be synchronized online in case of change user phone or him have multiple devices.
My question is how to do that:
I need authentication or can get the User's google account to identify him?
How should I synchronize these two databases?
If I use Backup API i can get the same data in diferents devices?
I need authentication or can get the User's google account to identify him? That's your decision. You could even provide both methods. Some people don't want to share everything with Google, others don't care. If you want to create your own authenticator read the Udinic blog post about it.
How should I synchronize these two databases? You need a sync adapter in Android and a receiving service in your web application. In the Udinic blog there is also a tutorial about sync adapters. On server side you could create a REST service for example.
If I use Backup API i can get the same data in differents devices? The Backup API doesn't seem to be the right choice as it only restores data during the initial setup and I assume you want to synchronize the data all the time.

Categories

Resources