Firebase for android and iOS application - android

I've been looking into implementing firebase for my mobile applications. I understand how to set it up on the applications. Followed some tutorials
https://www.sitepoint.com/creating-a-cloud-backend-for-your-android-app-using-firebase
https://www.androidhive.info/2016/06/android-getting-started-firebase-simple-login-registration-auth/
My questions are:
Can I authenticate my users by only username or uuid no password required?
How can I set up the database to get data from my current server.
Can I push different notifications to each user and have the option to send to a group or all users?
Thanks in advance

Yes you can achieve this using Firebase Anonymous Authentication for Android and for iOs. IMHO, is my actual favorite because you can actually log in a user without getting any information from them, no email, no password and no OAuth authorization necessary. You need just to click a button an log in.
An important thing to remember is that when the user decides to become a real user, you can merge those two accounts into a real account.
You can easily get data from your server accordingly to your operation system, Android or iOs.
For push notification i recomand you using Firebase Cloud Messaging. Is a cross-platform messaging solution that lets you reliably deliver messages at no cost.
Hope it helps.

Related

How to integrate a chat feature without using the device messaging app

Have 2 apps on separate devices: Rider & Driver.
Let's say, the Driver needs to contact the Rider via messaging, or vice versa, is there a way to do it without using the stocked message app to protect privacy?
My idea was to create on both apps an empty box, add a text view for the message and send button and add the msgs to firebase db. Unfortunately, i am not sure how i would do it in Android as well as the response.
Any suggestions or how to's would be greatly appreciated.
You could probably integrate your app with Firebase.
For simple messaging, you could use Firebase Cloud Firestore to do it and for notification, you can use Firebase Cloud Messaging.
Messaging
You can have a sub-collection to store all the chats between the rider and driver in the form of documents. 1 chat will be a document storing the info such as time, sender, as well as message.
Notification
From the doc:
Send acknowledgments, chats, and other messages from devices back to
your server over FCM’s reliable and battery-efficient connection
channel.
You could start research from Firebase sample application.
Highly recommend you go through this third party tutorial: Firebase Tutorial: Real-time Chat to get some idea, it's in iOS but the concept is the same.
Yes, there is a way to do it.
Actually you can use any messaging platform, e.g. Firebase, ConnectyCube, Twillio, Layer etc.
All of them provide API & SDK for iOS, Android and Web for chat so you can easily do it using it.
I used ConnectyCube some time ago, it can be done in the following way:
Initialize app
Sign Up user
Connect to chat
Create a chat dialog with other user
Send/Receive messages
More detailed chat code sample for Android can be found here
Most of the above platforms provide a cloud hosted plan, but some of them also provide an Enterprise plan when you the whole platform can be installed at your AWS/Google/Azure account, so hence the privacy is the best because you own all your data

Android chatting app development

I want to make an Android app where there will be several clients and an admin.The app will be installed in client's device.Admin can be send message from computer to the clients and clients could be reply the message.
The admin could be also send notification to the all clients or to individual client.
Can anyone give me some suggestions that which technologies should i use to build such an app?
You need to build a backend for your app with a database to store user informations , messages etc... I suggest you to use a non-relational database because access to db values it's more efficient for this uses-case.
To make it easy you could try Firebase Cloud Messaging.
Here the official site
Firebase
You can use the Firebase which provides you a bunch of products like notification, authentication,cloud storage, cloud messaging, Notification. You can easily integrate this in your app by just following the documentation.

Sending Firebase Cloud Message using UID of user

I want to build an Android app that allows a user to send notification and data messages to other users. I've started using Firebase only recently, and Firebase Cloud Messaging is still pretty confusing to me.
I have already implemented sending a message to a specific device using the Firebase Instance Id. However, in my app, a user can log out and log into their accounts using different devices, so this isn't really what I want. I read the documentation and it's pretty confusing, they mention sending messages to user groups, and topics (which only apps can subscribe to, not users).
Is there a way to send a push notification directly to another user or a group of users using only their UIDs? If not, is there any other way I can implement this?
I did it storing the FCM Token in a device structure by user. When the user login, add the deviceData to the userToken structure. You need clear deviceData when the user logout. This way, you will only send notifications to logged devices.
Ex (This is not like mine structure, but it can help you to wondering a good way to do this):
-userToken
-idUser1
-device
-idDevice1
-fcmToken: "xxxxx"
-idDevice2
-fcmToken: "YYYYY"
Hope that I helped you
Alright, so to make sure this works across multiple devices when a user logs in, I just make the device subscribe to a topic with the name equal to the user's UID. Now if I want to send a notification to a user, I just send an FCM message on the topic with the name equal to the user's UID!
Example: If my UID is equal to "asdf", whenever I login using multiple devices, each of the devices automatically subscribes to the topic with name "asdf". So now, if I send an FCM from the server on this topic, all the devices from which I am logged on to obtain this notification.

Messaging App using MQTT

I am trying to create a android messaging app using MQTT.
But i just want to know how the existing messaging apps(based on MQTT) work?
I am think of creating a unique topic for each user who installs and setups the app for the first time (providing his mobile no/email id for his topic to receive messages from others).
Once the setup is completed the contacts from users device will be synced with my server to check the available users.
And finally the user can select from the available contacts to send messages(publish messages based on the selected contacts mobile no or email id).
I know we should encrypt the contacts to protect the users privacy but,
Am i going in the right direction?
Thanks in advance.
Typically you set up a topic like
appName/device/[deviceID]
you could then put additional topics under that, like
appName/device/[deviceId]/contacts/contactName
You would then create authorization rules that limit a device to only publish things to appName/device/[deviceId]/# for the specific device id.
You could do a topic like appName/device/[deviceI]/contacts/online to get a list of available contacts... and a reply topic that gave back the results.

Can I use Google Cloud Messaging for two step verification?

We are developing an app that requires the users to be connected to the internet either via WiFi or via 4G or 3G.
Can we use GCM, Google Cloud Messaging, to register and verify a user instead of SMS ?
That is, we are trying to find an alternative to text message or SMS, for sending a verification code to the user, similar to the way that apps like WhatsApp do.
If you want to provide 2 step authentication for users of your website, certainly GCM is a very good option. Create table that links GCM ids to user ids. YOu will of course need to write a bit of code to handle GCM registration id changes.
If you want to provide 2 step authentication for users of your android app. GCM certainly isn't a good option. Why because the 2 step authentication should involve a different device.
You can also try Google Authenticator app. No need for SMS when you use it.

Categories

Resources