i want to send notification to my all authenticated app user - java

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.

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.

Sending a large string to multiple users

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

How to implement push notifications on my android device

I have a very basic design of my entire application, where several users with my app on there android devices commits data to the server (I have used REST web services(java) + postgresql as my server) through HTTP post request from the android application. I am successful in achieving this and app runs absolutely fine. Now i want to implement a scenario where any change(CRUD operations) on my db on server should create a notification on my users android device. How should i achieve this with my server design unchanged? I have looked into Google Cloud Messaging, but could figure out the server implementation.
For now i have implemented db triggers on postgresql and able to get control back into java code using Notify/Listen feature of postgresql. From here i need to connect to android device. How can this be achieved. Is Google Cloud Messaging the only way? I have not seen any insert/update statements in there server implementation. Could anyone please guide me on this?
either you can use GCM or implement a Socket at server end and open a socket connection from mobile but this approach may add some additional processing overhead because it will create a daemon thread to listen socket port from mobile device.
You should use native library (NotificationManager etc.), here you can find a great tutorial.
My Advice is for you to use GCM. GCM normally takes a maximum of 4kb, so you could have your own defined "commands". You could use them to determine the requests on both ends, ie on android app and the server end. A php script on the server would help you in this.
I am working on an app where by the android app sends messages to the server via POST and the server forwards the message to the appropriate user via GCM. In my case I have very many things to share so in that case I am using commands, for example if it is a new incoming message I send a GCM to the app with one variable as the command and the rest as the data. On the android app I use the command variable to determine what to do with the data.
Kindly avoid that socket advice, it will have your app drain the battery to sustain the open socket , besides you don't have to re-invent the wheel while Google servers already has it

Android app uninstallation event for analytics

I wonder what are the ways/patterns to detect app uninstallation for any kind of analytics on android? I know the limitations of ACTION_PACKAGE_REMOVED intent - not received by application being removed. I am using flurry at the moment and have also discovered that they do not provide any kind of support for deinstallation events. This type of event is definitely something you want in your analytics but so far have not found any clear solution. Any ideas?
Here's a possible approach. In your Android app, implement support for receiving push messages from Google Cloud Messaging (GGM). Then, implement a server that sends GCM "are you there?" messages to all users at regular intervals (e.g. daily). Google's GCM service will notify your service of all targeted recipients which no longer have your app installed. To correlate uninstall data with other metrics such as app version, user demographics, date of installation, etc, collect that data in your app and supply it to your server when registering for GCM messages. Then when you get notified of an uninstall, match it with the installation data. From there, you could report it to a service like Google Analytics for additional slicing and dicing, graphical visualization, date range comparison, etc.

What can you use to get an application to be able to receive SMS message?

Do you need to use some kind of provider?
Can you setup your own SMS server?
Does any open source solutions exist?
I am an SMS newbie so any insight on how this is accomplished would be great. I am partial to Java but any language is fine.
This is easy. Yes, you need a "sms gateway" provider. There are a lot out there. These companies provide APIs for you to send/receive SMS.
e.g. the German company Mobilant provides an easy API. If you want to receive a SMS just program a simple PHP / JSP / s.th.else dynamic web page and let Mobilant call it.
e.g.
Mobilant receives a SMS for you
Mobilant calls your web page http://yourpage.com/receive.php?message=...
You do what you need to do
You really don't want to setup your own SMS Server or Center ;-) This is really expensive, takes months to setup and costs some nice ferraris.
Use a provider and pay per SMS. It's the cheapest and fastest way.
I used kannel on a linux box with an old mobile phone connected via a serial cable to the box. Got a pre-paid card in the phone as I was using it for private use only. Worked like a charm!
You might take a look at Gammu if you're running on a Linux box:
http://www.gammu.org
Using Gammu, you can configure it to periodically poll a mobile phone for new SMS messages. When Gammu finds new messages, it can store them in an SQL database. You can then write another program to periodically poll the database and take action on new messages.
Using this general setup I successfully deployed a homemade 2-way SMS application. I configured Gammu to pull messages off of the phone over Bluetooth. Gammu placed them in a MySQL database, which I had a Tomcat web application periodically poll for new messages. When a new message was found, the system processed the message.
This is a somewhat "duct-tape and bailing wire" setup, but it worked quite well and was more reliable than many of the "professional" SMS gateways I tested beforehand. YMMV.
We've used mBlox (http://www.mblox) in the past, as they provide comprehensive international coverage, premium SMS, various levels of Quality of Service vs Price, and a solid Java-based API for both inbound and outbound SMS.
You will need an SMS gateway, googling "SMS gateway" will reveal many. I have used http://www.clickatell.com/products/sms_gateway.php with great success.
I do not know of any open source implementations, but will be monitoring this thread in case someone else does!
First, you need an SMS gateway. Take a look at Kannel SMS Gateway.
Agreed with Kannel. You can set it up on a LAMP server with a GSM modem too.
I'm not up with Java, so here's a nice guide on how to do it in Ruby on Rails: http://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application
If you want to send 'true' SMS you'll need to use an SMS gateway, (use of one is outlined in the above guide).
You can use MMS to send messages, to an email address that looks something like 1234567890# messages.whatever.com. You can use mail functions to do this. There's some information about that here: http://contentdeveloper.com/2006/06/open-source-sms-text-messaging-application/
TextMarks provides a service where they map an incoming SMS to them to an HTTP GET to a URL you provide and then send the response back as another SMS. They don't charge you if you let them add some advertising to the reply SMS. The problem is they don't provide this for free anymore for T-Mobile due to T-Mobile charging them. I'd be willing to pay per message, but they charge $0.20 per user-month, which is rather steep. Anyone know of anyone who provides this service?
You actually don't need an SMS gateway; nearly every cell phone can send/receive SMS messages to/from any email address. I built an SMS service (http://www.txtreg.net) using Nearly Free Speech's ability to forward email to a URL as a POST request. User sends a text to an email address, PHP script processes it, and sends an email right back to their phone.
Try SMS Enabler software. To receive SMS messages it uses a 3G/4G/GSM USB modem connected to a pc. It can forward incoming messages to a URL over HTTP, or store them in a database table, or write them to a CSV file, in real-time.

Categories