Is it possible to use facebook like Groupchat in xmpp chat? - android

According to my research, there is still a need to invite users before you can add them on your group chat (via xmppchat).. I want it to be like whats on Facebook messenger style where you can add users on your group chat without the need of inviting them.. is that possible on xmpp chat? can someone lead me to a link or at least tell me hows that possible?? please.. im having trouble for a week solving this. by the way im on android.

According to XEP-0045 section 7.8, the protocol states that a user needs an invitation to a MUC.
That being said, a way to handle it is to create a webservice on your server side that acts as an administrator, and takes care of the invites.
A very general way of doing this would be (Would work for both Android and iOS):
Client tries to enter a room (first sends request to server, and sets up an invitation listener). -->>
Server checks if the user is allowed (the point of the invite, determine .if a user is allowed by your logic: e.g. userid). -->>
Server acts as an admin and sends an invite.-->>
Client side invitation listener catches that and goes into the room.
to create as less requests as possible, the Client should cache the roomid for each room he "remembers" being invited to, and check that cache before sending the request.

Related

Link that will "preform" an SMS on android phone

Im building a service that will send an invitation to an event through a WhatsApp group using whatsapp API.
Of course, it will require me to interact with the request to select the group and so on, which is OK, but there is no way (without expending money) for my app to "read" who will join.
I though in sending a link, which on tap, will generate an request on the guest to send me back an SMS, and then my app to "listen" and generate a database of those who agree to be in meeting (my app later will send another message to the group to confirm o cancel the meet according to the amount of people who get involved).
I think i can ask the people to send, but if i ask them to write the sms, they will not do it (lazy people).
There is a way i can write a link like "sms:myphonenumber?ImIn!" to send, so the device will build the SMS for them?
I know from a web u can do something like href:...., and will do the work for them, but not sure otherwise.

One to One Android Chat using Firebase

I need some clarifications.
I'm using Firebase realtime database.
Now I've to implement a realtime chat between two android devices. I need also push notifications.
So, the solution based on realtime database is to drop because if the app isn't running, it will not handle the onChildAdded event.
I read on the documentation that I can achieve my aim, using the upstream message from the device to the server.
Now, it's written also that we need an app server.
I just want to be clarified the need of the app server (XMPP or HTTP), and which is the entire flow of message m1 sent from the device A, and the notification on the device B.
In my opinion the app server should act as a man in the middle, so:
A ---> XMPP SERVER ---> FCM
FCM ---> XMPP SERVER ---> B
Is this the flow?
On the documentation I can't understand if I'm right or not.
If so, how do I send a message from the FCM back to the XMPP Server?
The notification message is sent from FCM to the client o from XMPP Server?
Please someone clarify me.
Other solution thought by me:
Since I find really powerful firebase realtime database, I thought these solution to walk around the problem:
Create an app server the is listening for onChildAdded and when it changes send a notification to client device.
Creating a background service on the client app listening to onChildAdded and create notification when necessary.
Even all, I don't like these solutions.
Just want to understand the standard and correct way to achieve my aim.
Firebaser and author of the article debated in the question comments here
To send messages to a device with Firebase Cloud Messaging, you need to specify your project's FCM Server Key. As its name suggests, this key should only be used in code that runs in a trusted environment: i.e. a server that you control.
To send device-to-device messages (such as in a 1:1 chat application where the receiving user is not necessarily online) you need two steps:
one user send an upstream message
the other user receives the downstream message
Using Firebase Cloud Messaging and your custom app server code, you can handle step 2. But that still leaves step 1: the user needs to send a message that somehow triggers your code on the app server. There are quite a few ways to do this.
For example you could implement an HTTP endpoint on your app server and have the chat application send the messages there too (in addition to sending to the database).
You could also implement an XMPP endpoint and have the chat application send the message there (again in addition to sending it to the database).
My article suggest yet another way, one that doesn't require implementing an endpoint at all. It uses a node.js script that runs on your app server and is essentially just a client to the database. Whenever this script detects a relevant chat message, it calls the FCM API and sends the downstream message.
This pattern of using the Firebase Database as your endpoint and then using server-side scripts is quite common when using Firebase. We documented it in our classic blog post Where does Firebase fit in your app? (as option 2) and in this article in the Google Cloud documentation.

Notice from Openfire Server to android user

I am developing an application in android using XMPP with openfire server..I want to develop a notice board application in android client side...And in the notice board all the data are retrieve from the server post by the administrator from openfire server. Can it be possible to post the data from openfire server so that we can receive notice in client. Though there is the feature to send message to all online users but I want to built like a notice so that admin can post something in the notice board and user can click on notice heading to read the full news.
I am sorry if there is any plugin to do this one..
The Publish Subscribe extension sounds like an ideal candidate: http://xmpp.org/extensions/xep-0060.html
It allows clients to subscribe to a feed (in this case the server notice board) and get notified when new items are posted. Depending on how you've configured it (there are a lot of options both in the client and Openfire, it's worth taking a look) the client will either receive a notification of a new entry and then need to request the full story from the server, or receive the full payload in the notification.

Detect when a new account has been created or a subscription request handle?

We are developing a XMPP-based notification system, we have a server and several android devices and our OpenFire server acts as a communication gateway.
On the server side, there is a OSGi bundle, which is responsible to receive all the messages from the devices and map the corresponding action.
I want to avoid anonymous login, to have some control of who is sending messages to the server, but on the other hand I want the client to auto-signup when using our android-client.
So well, my first idea was either to listen to the AccountManager and check any newly createad account and, if proceeds, add it to the server roster.
The second option is handling all the subscription requests, check whatever, and add it to the server roster in case. Obiously for the second option the client needs to request the subscription to the server, but it's easy to achieve.
I found a possible workaround for the second option here, but what option you guys think is the best?
Any other recommendation/suggestion besides these two is also welcome.
It looks like pubsub (XEP-0060) would be a better fit, since it doesn't require your roster management at all. The android devices become publishers and your bundle will be a subscriber.
Based on limited information, it looks like you could simply have all users become publishers to the same single node, and then publish messages that the server side bundle will subscribe to and handle accordingly.
Some docs for Smack on pubsub.

Using XMPP for push user notifications on Android - any way to target these so they don't go to Google Talk etc

I want to use XMPP to push data to my client which would translate to a notification for the user, and plan on using their google-id for login to my application. The way I understand XMPP is that its a simple message that goes directly to the adress, but I want the client to get it as instructions and turn it into gamestate information.
It would be very frustrating for a user to get a bunch of command tuples or hex garbage in their google chat! Am I misunderstanding the way this all works?
JIDs (Jabber/XMPP IDs and therefore Google Talk IDs) have several forms.
First is a "bare JID", e.g.: user#example.com
Secondly is a "full JID", e.g.: user#example.com/xyz123, where xyz123 is called the resource.
One user can be logged into their XMPP account from multiple clients simultaneously, so long as each client uses a unique resource. With Google Talk, usually the server allocates the resource.
When you talk to someone on XMPP normally you address messages using their bare JID — you don't care about which client the message gets delivered to; that person's server directs it to the appropriate client(s) based on their availability etc.
But you can also address a message directly to a full JID. This is what you want to do, so that only user#example.com/my-game-some-unique-ID receives your game-specific messages.
Whether the Google App Engine API gives you this flexibility, I have no idea :)
An alternative — again, if GAE allows this — is to send a different message type.
XMPP is eXtensible, meaning that you don't have to send a plain old <message/> stanza to the end user; you can stick a specialised payload inside there like a <game/> child stanza and, because regular IM clients don't know how to parse your <game/> stanzas, they show nothing to the user. Only your game client will parse and understand this info.
“Xtify has an out of the box solution that runs a variant of XMPP. You can then use their webservice to push notifications and custom data and intents to the device and your app. I've been using there more standard solution (platform for push and managment), but the push API works and is free.

Categories

Resources