Announcing Java for Microsoft Push Notification

2,603 views
Skip to first unread message

Mahmood Ali

unread,
Jun 25, 2011, 1:14:20 PM6/25/11
to java-apn...@googlegroups.com
Greetings everyone,

I am happy to announce another Java push notification library
targeting Microsoft Push Notification Service. Like java-apns, the
library aims for elegance of client code along with flexibility and
compile type checking for notification construction. Also, the
library supports reusable connections to Microsoft MPNS, along with
Queue (using a primitive message queueing system) and Pooled
connections.

The library is hosted at: https://github.com/notnoop/java-mpns , and
will be hitting the public maven repositories soon (once I do more
initial testing).

As a teaser, the client code would look like:

MpnsService service = MPNS.newService().build();

MpnsMessage notification = MPNS.newMessage()
.tile().count(2).title("Tile message")
.build();

String subscriptionUri = "https://..../"
service.push(subscriptionUri, notification);

The library is available under the new three-clause BSD license, so
basically you can use it to your heart contents.

The library is the result of the generous sponsorship of Excitor A/S,
creators of DME, the ultimate mobility solution for enterprises that
want a secure, easy and useful access to mobile data.

Regards,
Mahmood

P.S. Android developers should except a similar announcement soon as well.

Kamcheung Sham

unread,
Jun 25, 2011, 1:30:42 PM6/25/11
to java-apn...@googlegroups.com
Nice work. What are the typical java-based solutions for Android platform?

Thanks,
kc

Mahmood Ali

unread,
Jun 25, 2011, 2:52:00 PM6/25/11
to java-apn...@googlegroups.com
Greetings,

> What are the typical java-based solutions for Android platform?

I haven't seen a Java library for pushing the Android C2DM
notifications yet (there are many client ones).

However, the C2DM interface seems to be the easiest among all the
libraries. It's simple that you can actually use curl for it[1].
However, I think there is a significant complexity in the retry logic
(Google/Microsoft recommends exponential-back off algorithm), and
authentication (using Google ClientLogin).

I'm not quite sure how to best solve these two problems. The first
requires a proper durable queue to get right, otherwise there is a
risk of losing messages. The authentication problem may require
manual intervention (e.g. to solve a captcha for example).

Any suggestions?

Regards,
Mahmood

[1] http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html#example_curl

Andrew Kinnie

unread,
Jun 27, 2011, 9:25:29 AM6/27/11
to java-apn...@googlegroups.com
I haven't seen any for Android either.

I have to say though, while it may appear that it's easy, for me, who is not experienced in making http connections and parsing responses, I have been banging my head against a wall trying to use the apache library and following google's instructions. Our Android guy is having similar issues. I can make a connection with the server, get a response with the authorization token, save it, and the device can do a similar connection and get a registration_id but when the server then sends the message with the auth token and registration_id, I get nothing but 401 unauthorized errors.

Your APNs library makes the Apple stuff much clearer and easier, and I'd basically found a religion in your name if you could do that with Android. OK, maybe a cult.

Andrew

Mahmood Ali

unread,
Jun 27, 2011, 12:01:36 PM6/27/11
to java-apn...@googlegroups.com
Greetings,

> I haven't seen any for Android either.

I have just created an Android C2DM library: https://github.com/notnoop/java-c2dm . I haven't tested it yet, so it may have very silly bugs in it. Will be testing it further soon.

> I get nothing but 401 unauthorized errors.

Currently, C2DM in in Labs, and you need to sign up and be approved first: http://code.google.com/android/c2dm/signup.html . Has the developer gone through the approval process already? Feel free to pass him my contact info so we can ensure the reliability of the java-c2dm library.

Regards,
Mahmood


Andrew Kinnie

unread,
Jun 27, 2011, 12:10:35 PM6/27/11
to java-apn...@googlegroups.com
Well, I'm the developer of the server side, though I didn't sign up for the service, my boss did.

I am able to get the auth token from the server, and the app developer is able to connect and get a registration id. it's the sending part that fails.

Mahmood Ali

unread,
Jun 27, 2011, 12:28:54 PM6/27/11
to java-apn...@googlegroups.com
Greetings,

I just tested the library and it seems that it working pretty well for the simple cases. I'll test it further and send another announcement.

> Well, I'm the developer of the server side, though I didn't sign up for the service, my boss did.
>
> I am able to get the auth token from the server, and the app developer is able to connect and get a registration id. it's the sending part that fails.

Please verify that the account you are getting the AuthTokens of is actually registered using the C2DM sign up form. I was able to get a auth token before using the form, but was getting a 401 error as well. Once I signed up and got approved (took about 15 minutes), I needed to get a new auth token and then my push notification worked.

My availability will be very spotty today, but please give it a try and we can investigate the problems later.

Regards,
Mahmood


Alex

unread,
Oct 29, 2012, 12:15:53 PM10/29/12
to java-apn...@googlegroups.com
Hi Mahmood,

I know I could be the only user trying to send push messages to all 17 windows phones out there :), but I was wandering if you plan supporting Transport Layer Security and authentication for your MPNS framework.

many thanks,

Alex
Reply all
Reply to author
Forward
0 new messages