Sending a large string to multiple users - java

My problem is how can I program an android app that sends a large string of alphanumeric characters to multiple android users.
QR code is limited and can't use special characters and lowercase ones.
Is it possible to send the string to multiple android users with the same app?
Just like ShareIt.
Please provide a reference where I can study more.
I'm new to Android, zero knowledge

One solution approach could be using a server and push messaging service. It can work as follows:
When someone (sender) wants to send a message, A query will be sent to the server with the message data.
The server receives the message and saves in a database. Here, we will get a reference to the message in database.
The server then sends the message to all receivers via push messaging service.
Caveat: The push messaging services have limits on how much data can be sent at a time. This can be overcome by sending the receivers only a reference to the message. In this case -
The receiver will query the server with the reference of message.
The server will response to the query with the message data.
All of this can be set up using Google's firebase platform. In that - firebase database will provide database, firebase cloud functions will handle the request, response logic and also send messages via the firebase cloud messaging

Related

Is storing ARNs the correct way to register and send to AWS SNS?

I'm trying to implement push notifications via AWS SNS using FCM/APNS. I've successfully done it manually via the SNS console and now I'm trying to implement the whole process via Java.
The tutorials are short-stopped at demoing the manual method and the AWS SDKs are not that explicit. The things I want to implement via SDK are
Create Platform Application ARNs (FCM/APN)
Create Endpoint ARN (Device Token)
Send Message to Endpoint ARN
Now each step is dependent on the previous step ARN, is it correct that the way to get these ARNs is storing and retrieving them on our database?
For example, to register an Endpoint ARN, I get Platform Application ARN from the DB (with the user's device token), register it on SNS and then save the endpoint ARN response to the DB?
Now if I want to send a message to that user then I just get his endpoint ARN from the DB and publish a message?
If you know of any guide that is useful for using SNS in code, either JS or Java you can put it in as an answer as well.
The recommendation is indeed that you store the ARN in your database for retrieval when you want to send a notification to that user. Most applications have an internal mapping, e.g. from user ID -> device ARN that SNS does not know about. This makes it difficult to target specific users unless you have this stored somewhere.
There is pseudo code available here which goes over best practices for creating and managing platform application endpoints. Keep in mind that this would all be running on your server.

How to query message send record in Firebase Cloud Message? [duplicate]

I have an iOS app that integrated with Firebase Cloud Messaging to send push notifications from. I know that Firebase saves history of all sent notifications.
Is there a way for each specific device running the app to fetch its own history of sent notifications? I need to do it on client side, not on server.
There is currently no API to retrieve details of all the sent notifications with FCM (see this and this).
The idea is still feasible, however, you'll have to store the logs/history on your own, in your App Server. From there, you could setup your app to retrieve the details that only correspond to the device.

i want to send notification to my all authenticated app user

I have an application that contains order data . I want to send this to all users of this app as notification.My target is to send Push Notifications to all of the users of my applications. How would I accomplish that?
To begin with your app mush already be using GCM and listening to the correct topic. Otherwise you have to roll out an update with the new GCM feature and hope that all users update it.
If you want to see some code for this take a look at this sample i crated some time ago. What you need to implement from the sample is the "SubscribeTopic" part. And to test if its working you can use this java program.
The good thing about topics is that you don’t need to save the users registration tokens and the message is sent to everyone listening for that exact topic.
Use Apache kafka
The original use case for Kafka was to be able to rebuild a user
activity tracking pipeline as a set of real-time publish-subscribe
feeds. This means site activity (page views, searches, or other
actions users may take) is published to central topics with one topic
per activity type. These feeds are available for subscription for a
range of use cases including real-time processing, real-time
monitoring, and loading into Hadoop or offline data warehousing
systems for offline processing and reporting.
To start with, note that a full GCM implementation requires both a client implementation and a server implementation. Before you can write client apps that use GCM, you must have an application server that meets the following criteria:
Able to communicate with your client.
Able to send properly formatted requests to the GCM connection
server.
Able to handle requests and resend them using exponential back-off.
Able to securely store the API key and client registration tokens.
Note: never include the API key in any client code.
For XMPP, the server must be able to generate message IDs to uniquely
identify each message it sends (GCM HTTP connection server generates
message IDs and returns them in the response). XMPP message IDs
should be unique per sender ID.
Complete documentation, how-to-guides for sending messages and links to examples can be found from Cloud Messaging - Messaging Concepts and Options.
You may also check ANDROID AND GCM – BROADCAST YOURSELF for the tutorial and demonstration on the use of GCM for the broadcast of messages to an Android client from a Tomcat server and use of sending broadcastintents from a service and receiving those broadcastintents from an app's activity.

How does a chat app communicate with it's server?

I currently am developing a semi-simple chat app. I want the user to be able to communicate with one other person in a private chat. Just plain text will be sent. Currently my system calls php scripts from a webpage, passes in parameters and then parses the data returned. I have it so that the client sends the message, which calls a send message script on my webserver, the script then makes a message file on the webserver and then returns a success or failure back to the client. Then for the client to view this message, it would have to call a script that checks the server for a message file with a message for him. If it finds one, it sends the message back, if not, it sends a response about not having messages.
This technique works perfectly besides the fact that the client either would have to manually refresh to check to see if he had messages, or a background thread would have to refresh every few seconds. That would be fine, however that would use data if the user was on a mobile network. Not to mention the kind of resources a background loop would pull if it was refreshing at a speed that would be convenient.
So, I decided on a second idea, this would be a server programmed in Java, which would communicate over sockets. The user would send the message as a packet over the socket and the server would check to see who it was meant to go to. If the person is online, it passes the message along to that user. However this method requires a constant connection between the client and the server and that is unreliable because what if the user is in the car and data cuts out. Or some other situation where the connection gets severed. Then it would throw errors and have to reconnect.
Anyhow, my question is which technique is better. Or are they both terrible? If so, what is the correct way of doing this? Thanks in advance.
AngularJs and Ajax will be the perfect solution for you , try to learn
for actually real time messaging Use AngularJs
If the amount of data is very less ..say 20-25 messages per day...you can REST APIs on your server to transfer actual text messages and Google Cloud messaging for pushing notifications..Recently I followed this approach to develop private chat for one of my friend.

Send notification to the client from a web server

My setup consists of a Weblogic server that runs various REST services that accepts an HTTP request from a client(an android app), reads data from a MySql database and sends this data as a response to the client.
My requirement is that the client should be notified as soon as the database is updated. I have implemented a "polling" mechanism. The client constantly sends requests and checks for any changes made in the database. However this is not a very efficient mechanism.
Can you please suggest any efficient ways of achieving this?
Thanks in advance!
One of the way to use writing a CRON job for observation of Database change.
also, SO has already discussed this topic. refer below link,
Oracle database to send notification / Invoke a java method on reaching Time specified in a column

Categories