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.
Thanks,
kc
> 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
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
> 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
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.
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