Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTEXT-19: Push Notification adapters for Android devices #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amolnayak311
Copy link
Contributor

The PR is for adding the initial support for sending push notifications to mobile and hand held devices.
This is the first of the many services to be supported from Spring Integration for pushing to mobile devices from java applications.

The umbrella JIRA for this is
https://jira.springsource.org/browse/INTEXT-18

and the specific JIRA to support push to Android devices is https://jira.springsource.org/browse/INTEXT-19

* The parameter used to carry the registration id of the device to which the notification
* is to be sent
*/
public static final String REGISTRATION_ID = "registration_id";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An interface should not define constants. Ideally this may be best suite for an enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do this change, rebase and push

@ghillert
Copy link
Contributor

Shouldn't we use Android API to do server push, rather than implementing our own infrastructure? (using gcm-server.jar)

com.google.android.gcm.server.Sender sender = new Sender(senderId);
List<String>registrationIds = new ArrayList<String>();
ids.add("12345");

Message msg = new Message.Builder()
.collapseKey("1")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message","This is a notification 423424234")
.build();

sender.send(msg, ids, 1);

Shouldn't we have an inbound adapters to handle client "subscriptions"?

@amolnayak311
Copy link
Contributor Author

The Idea is to have a common abstract service implementing the functionality like exponential retry for all implementations and delegate to the underlying service to do the actual push. Ideally we shall be having the common abstract class for all our implementations. The push part for android we have implemented is as per the specification given for GCM and there isn't much code in it. Implementing them using GCM Server should be fine as well I guess ( I had seen this when I had developed the service but intentionally decided not to use it for some reason, I am afraid I quite don't remember why I decided that :D )

For the client subscription, it is the responsibility of the handheld device to provide the application server with the registration id it received from GCM services. Now this can be send using plain TCP/IP , HTTP, use a web service etc, depending on what is the protocol between the application and its server side. To achieve either of these we can use the TCP , HTTP or WS inbound adapters and then use the JDBC or JPA adapters to store the registration id in database. That's why I think any inbound adapters for them won't make much sense and doesn't add much value. You have any other view or idea in mind?

@amolnayak311
Copy link
Contributor Author

Got rid of the interface and moved the constants to the implementation class. Rebased and pushed the changes

@cdelgadob
Copy link

What's the status of this development? It seems to me a very useful functionality, but it's been a while since the last update in JIRA

@amolnayak311
Copy link
Contributor Author

Hello cdelgadob, its being reviewed and should merged soon. Meanwhile if possible, we would live to have your view on it too. :)

@cdelgadob
Copy link

Hi Amol, thanks for your answer, that's good news. I'm happy to help and review it, just tell me where to get it from and I'll come back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants