How I can send request to the nearest app user just like Uber in flutter - flutter

I want to create an application just like Uber using Firebase. I do not under stand how I can show the nearest application user on google map using costume markers and how I can send the request to the all nearest application users at same time just like Uber do.

Since you're already using Firebase, you can use Firebase Cloud Messaging. This is obviously a rather big feature that will envolve lots of sub-tasks, but here's a simplified overview of how it could be:
You have three players involved:
the "Uber user" client app
the "Uber driver" client app
your app server (which could be Firebase Cloud Functions, for a serverless backend)
The data flow could be as follows:
"Drivers" open their apps. This establishes a connection with the server, and keeps the server constantly updated with their geolocation.
A "user" opens his app. This triggers a request to the server sending the user's geolocation.
The server (which knows the realtime location of all drivers) calculates which drivers are near the user, and responds the user request with this data. The user client app can now render a map widget with the drivers locations (for this, you'll probably use a package like google_maps_flutter).
The user clicks a button to request a ride. This again triggers a request to the server.
The server receives the request, and notifies the nearby drivers using Cloud Messaging. FCM has a message type called Data message which is well suited for this; you can send custom data, and the client app will process it however it wants.
The drivers' apps receives this Data Message and render the UI showing there's a ride available. If the driver accepts the ride, this sends a request to the server.
Once the server sees the "accepted ride" request, it sends another message to all other drivers informing the ride is no longer available, as well as sends a message to the user informing the ride has been accepted.
As I said, this is not a simple feature. There are several tricky parts, such as race conditions, and making sure only a single driver accepts a ride. But this should be a high-level overview of how it can be done.
Finally, this schema is a quite technology agnostic; it isn't specific to Flutter. The architecture to have that feature could be implemented like this in pretty much any modern mobile framework - Flutter is just a UI framework.

Related

Sending React Native Notification on database update?

I have an AWS Postgres database, an API layer, and a React Native application. One user is trying to communicate with another (and this will be stored in the db) I want to let the intended user know that a message awaits them with a notification. I'm not using expo. I've looked at using OneSignal but the functionality seems limited in this aspect (unless I'm missing something) I've prefer to use React Native Local notifications. Does anybody know how to achieve this with either OneSignal or RNLC?
You want 2 users to communicate with each other, and via a notification to let them know they have a new message. You can send push notifications directly to a user by using the player id and our REST API. The player id will target only the user the notification was meant to be sent to.
https://documentation.onesignal.com/reference/create-notification

Can I turn data in google assistant app into file format for upload?

I am creating an app for google assistant which will collect data while a user plays a game and then send that data to a project database. The API I am using to sent the data (synapse) requires it to be in file format, however, I can't find a way to create a file for the data due to the nature of google assistant apps. Am I overlooking a way to do this/is there a way to get around this and send the data somewhere else to make it into file format? The data is stored in a JSON object.
The conversation that your users have with your Action will be relayed from their Assistant device (such as Google Home) to Google's servers, which do a little processing, and then to your server. Your server is then responsible for sending back a reply to Google's servers, which sends it on to the Assistant device. This is very similar to how a web browser and server work, and for good reason - your server accepts commands via a "webhook", which is just a fancy way of saying that Google's servers contact your server via HTTPS, and you're sending back a reply via HTTPS.
Your webhook can do anything - as long as it does it fast enough. You can store what command the person has issued and either aggregate a number of them into a file format to send, or send each one.
Your Action does not, itself, run on the user's device any more than a web page with a form "runs" on the user's device. It displays there, just like your Action is read out loud... but almost all interaction is sent back to you with minimal processing on the device itself.

Real-time notifications with Firebase & Ionic

NOTE : Don't say it's possible duplicate of this, Read through.
Think of a simple TASK Management application which can have n number of users. Say User A can create a task & assign it to User B. I want to show a notification to User B.
I am using Firebase as BAAS and following code-snippet prints on console only when there is a task assigned to User B. To simplfy, Users collection in Firebase has a node called tasksAssignedToThisUser array and callback function will be watching tasksAssignedToThisUser location. Whenever a new task gets added to that array, callback function gets executed. Here is the code snippet:
var rootRef = firebase.database().ref();
rootRef.child('users').child(loggedInUserID).child('tasksAssignedToThisUser')
.on('child_added', function (newMessageSnapshot) {
console.log('Someone assigned a task to this user.');
console.log(newMessageSnapshot.val);
});
Everything works fine until here.
What I have understood by reading Firebase docs & other post's on SO about Push notifications or Firebase Cloud Messaging is:
Firebase Notifications lets users easily send messages to reengage and
retain users, foster app growth, and support marketing campaigns.
Before you can write client apps that use Firebase Cloud Messaging,
you must have an app server that meets the following criteria:
...
You'll need to decide which FCM connection server protocol(s) you want
to use to enable your app server to interact with FCM connection
servers. Note that if you want to use upstream messaging from your
client applications, you must use XMPP. For a more detailed discussion
of this, see Choosing an FCM Connection Server Protocol.
This is definitely not what I want and maintaining a server for sending push notifications makes sense when bulk messages needs to be pushed to large number of devices. So I didn't name my question as Real Time Push Notifications.
I see a function being executed, which meets my use-case and I just want app to display a notification to the user in his mobile system tray on that callback function execution.
I am using Ionic 1 for developing app, completely new to Firebase and Ionic too. If there is a simple serverless approach that Firebase itself provides which can suffice my requirement, then I would be more than happy to hear about it.

Laravel socket chat application

I'm new with web sockets, and i want to create a private chat with laravel between authenticated users and anonyme users , i'm not asking to give me the codes, i want a way to do that , i want to understand how can i do that
I'm thinking to that for a couples days ago, and i fount that i should make this steps :
1- Create chat with socket
2- intergrate it with laravel (1)
3- show connected users ( i don't know id if that i should make that with socket or with laravel framework )
4- fix the chat to make it private ( build some socket or somethink like that)
i want to know how i can do that ?
Thakns
https://packagist.org/search/?q=socket
If I were doing this, I would separate the sockets server and the frontend implementation.
This would allow you to scale both the dispatch and the client services at different rates.
You can use any library of your choosing, usually the best is going to be on the top.
http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket
That explains it a bit more than I am willing to.
basically you will have one instance of laravel that is only responsible for rest/socket communication. It will provide the client(frontend) with the information that it needs.
When a registered user logs in, You simply notify your socket server via rest a user has logged in, In turn your socket server will query the db for all currently logged in users, trigger the event of UserLoggedIn , attaching perhaps an array of logged in users which would then be broadcasted to all of the listening clients.
When a client receives that notification, your js (if necessary) would update the list of available chatters with the one provided by the dispatch.
You will also need to maintain a list of active unregistered user socket connections so that you know who's where and who should get what message.
This is the general idea behind it.

UCMA: Chat with users not in AD

a customer wants enable a chat/instant messenger for his application webside. He is using Lync Server internally to Chat in-house. Now, he requires the following:
A external user (which will not be an AD user) logs into the webside is able to chat with a person inside the company. The internal user will receive those messages via his lync client.
What's the best way to achieve this?
i thought about bot that delegates messages from the webside to the lync server that does the rest. But how can i send a message as an external user?
The usual way to approach this is with the following components:
A bot that connects to the internal Lync infrastructure as an ApplicationEndpoint, and manages conversations with external/internal users
A Web or WCF service that exposes methods over http to external users - this could be built into the bot, or could be a separate service that communicates with the bot in some way
The web UI for presenting a users presence, allowing click-to-call, initiating and displaying a conversation etc
As an example, the WCF service could expose a few methods:
GetPresence(targetSipUri) - returns a presence value for the given uri
SendIM(targetSipUri, message) - sends an IM to the given uri
GetReplies() - polls for any responses
When you get into the detail you might need more methods - e.g. it may be an idea to generate a conversation token and pass this around
The web UI could present a list of contacts with a presence status (GetPresence), then allow the user to click a presence contact to initiate a new conversation window and send the inital message (SendIM), then poll the service for any replies from the contact (GetReplies) - note, the bot will have to queue replies internally until GetReplies is called.
There are commercial products that might meet your needs - a quick search for Lync webchat should turn up a few. Also, it may be worth looking into the Lync Web App, to see if this works for your customer
Edit: In answer to the comment below - yes, your internal users will see a conversation from "Our Lync Bot". If you don't know who your users are (e.g. random potential customers browsing a shopping site), you can grab some info from them (name, product to discuss etc) and have the bot display this to the internal user, either as part of the IM conversation, or as conversation context displayed in a Conversation Window Extension.
If your external users are known in advance (e.g. registered customers), and the internal user MUST see the conversation as being from them, then you will need to create a UserEndpoint for each conversation - but this would rely on having the user in AD.