Data Model for Firebase/Firestore chat application - java

This is the current Firebase/Firestore data model I am using for my test chat application. However, this model is very hard to use for push notifications on Android side. I want to send push notifications to users phone when they receive messages from any of the channels they are part of. In addition file/image messages need to be added.
Any recommendations or any examples of good data models for chat applications I can use as a reference.

If you want to try another approach regarding a Cloud Firestore database schema, here you can find a tutorial on how you can structure the database for a Chat App.
I have also exaplained in another tutorial of mine, step by step, how you can send notifications to specific users using Cloud Firestore and Node.js. You can also take a look at my answer from this post.

Related

How to send notifications depending on the Firebase data using Firebase Cloud Messaging

I have an app where people sign up for events and I want the app to notify the users registered for and event the day before it happens. All the data is stored in Firebase. So basically I would like to know how do I make my app read from Firebase the data from all the users in a regular basis and if a user is signed up for an event and the date is close send him a notification, without the admin having to do anything or using the console. Thanks
If you want to make this process automatic You can write Firebase cloud functions and can add triggers on nodes to execute cloud function, In that cloud function you can send push notifications using FCM depending upon your requirements. here are the helping links
Firebase Cloud Functions
Firebase Cloud Messaging
Otherwise if want to avoid cloud functions you can directly send message from App to App using FCM without involving server.
If you're looking to keep all of your server side logic running off of Firebase, the Firebase Cloud Functions are what you're looking for.
Here is the documentation for setting up functions to be run on a schedule: https://firebase.google.com/docs/functions/schedule-functions
If you're not looking to run your service from the Google Cloud, then the next best option is to setup CRON jobs if you're using a Unix based system, or the Task Scheduler if you're running a Windows based system.

How to implement a messaging service in react-native with a java backend?

I am creating an app using React-Native for the front-end, Java for the back-end and PostgreSQL for the database.
One feature of this app is to allow users to add each other as friends and instant message them - just like other social networks. At the moment, security is not a priority but I don't want to create something that I will have to completely redo when I do have to make it secure!
The goal here is to give each user the ability to send/receive messages to/from their friends. They also need to be able to view the message history with each contact.
I just need some advice on the following points to get me going as I haven't gotten very far on my own:
How should I send messages from the front-end, to the Java server and then to the receiver? This will involve the app having to listen for new messages so would the Socket.IO library be the way to go for this?
How I should store the messages in the database? E.g. have a table for messages with user_ids to be used for retrieval?
I should point out that I am very new to React-Native, databases and networking so I am finding this very challenging!
I will massively appreciate any help and any examples would be fantastic!
You should use WebSocket on the server. Spring supports it
Here's a tutorial I wrote about sending messages from PostgreSQL to the browser using WebSocket, which isn't exactly what you're going to do, but can hopefully get you started:
http://blog.databasepatterns.com/2014/04/postgresql-nofify-websocket-spring-mvc.html

Database using Java

I am making an application similar to that of apps such as pay by phone and paymobile, which are apps used to pay for parking instead of using a parking meter and having to display a ticket in your vehicle.
I need to start with the back-end (the database) and was wondering if SQL would be appropriate for this app.
As SQLite is stored on the system (the Database) there will be data such parking details and payment details.
Will I be able to send this data to say my laptop which will act as the server for the traffic wardens device to check number plates?
Or would I have to use a sql software that is not on the applications itself?
Any thoughts and suggestions would be much appreciated :D
SQL is perfect for back end database needs. You can various flavors of SQL like Oracle or MySQL on the back end. As far as the application data being sent to the server (your backend laptop), that will be taken care by the application level programming. For android, there are various ways to send data, using the native class AsyncTask or using third party libraries like Retrofit and Volley. You need to take a decision depending on the architecture of your app.
Try this
Create database on your server
Create Web API like .Net MVC on your server
Create connection between your Web API and your database
In your mobile app you can use webservice to get our put your data to database
You can encyrpt your data on your database to more safety
do not use SQLite , because it is unsafe to keep your important data.

Chat using Parse in android

I am developing chat application using parse. These will be a group chat application.
There are many number of groups possible. I have implemented parse and also have knowledge about it.
But I want to make it real time chat application.
I know I can do it with the help of push notification but having lack knowledge of implementation.
Can you guys please suggest me some other way of doing real time chat or how to exactly work with push notification to make real time chat application.
So here are some queries:
Can I develop group chat using parse ?
Does it feasible solution to use parse for real time chat ?
If yes , then how can i make it real time chat. ?
Parse platform is not suitable for real-time chat applications as it does not support persistent websocket connections. You can still use Parse to send notifications but you should use other providers with real-time support like PubNub or Firebase
Regarding Mo Nazemi's answer, you should also look into Layer and SINCH, sinch alos includes VoIP

Storing / Retrieving App Data Online using Android

I am new to Java and Android. I am just beginning work on an app that will save information to a server that someone else from within the same company can retrieve using the same app from a different android device. I know how to simply store data on a server using simple php scripts but this is a bit more complex and involves one user writing information to the server, while another user can see / download it. Within a company there would be multiple users who have acceess to this data. So my question would be, whats the best way to implement a company-wide database that ONLY members of the same company can have access to? Sorry if this seems obvious to some of you. I am just getting started and I have 7 books on android programming and none of them describe how to do quite what I am trying to do.
To do this you need to use Android network services to access data. In other words to retrieve a networked database information your device will connect to your service with a specified URL and arguments. In turn, the service will reply with the required data, say may be in XML format. All your app needs to do is parse the XMl and display the date as desired.
Same thing applies to putting data into the server, in this case however the data will be sent as arguments to the network service URL and the service will handle the persistence to a database.
My advise is to do a Google search of the keyword "Android Network Services".

Categories