Push Notifications for Android, iOS and Web

Today we are releasing the first community release of the AeroGear UnifiedPush Server!

The AeroGear UnifiedPush Server is a server that stores devices specific metadata and is able to sendpush notifications to different (mobile) platforms. The initial version of the server supports Apple’s APNs,Google Cloud Messaging and Mozilla’s SimplePush.

Three supported platforms

While Android and iOS are pretty much very well known, it’s worth spending a few seconds onSimplePush. SimplePush is a specification from Mozilla that describes a JavaScript API and a WebSocket-based protocol which allows backend/application developers to send notification messages to their web applications. Originally SimplePush was introduced for Firefox OS but there are plans to establish the API on the desktop and mobile browsers as well.

The AeroGear project is releasing a Netty-based server and a polyfill JavaScript library for SimplePush as well.

A few problems with Push Notifications

In order to be able to send messages to specific devices, the server side application needs to know the device token, which means the application on the device needs to store it on the server side database.

Another problem is that if you are supporting multiple platforms, they all have different APIs and behave differently – not only on the client side. You need to ensure that the server side application sends the notifications to all clients, for all supported platforms.

Enter AeroGear UnifiedPush Server

The AeroGear UnifiedPush Server addresses these concerns as it is capable to store device specific metadata, including device tokens and it offers a unified way to deliver notifications to Android, iOS and JavaScript applications.

REST API

All features of the server are powered by RESTful APIs:

  • registration of device specific metadata
  • sending push notifications
  • Management of the PushApplications and their different variants

AdminUI

The management of the PushApplications, their variants and all of the actual device installations are best handled by the AdminUI, which is based on Ember.js and Topcoat

Device Registration

As indicated on the above image we have SDKs for our supported platforms (AndroidiOS and JavaScript) to help registration of client devices with the AeroGear UnifiedPush Server.

Sending Push Notifications

Sending can be done over the RESTful API:

curl -u "{PushApplicationID}:{MasterSecret}"
   -v -H "Accept: application/json" -H "Content-type: application/json"
   -X POST
   -d '{
       "someKey":"someValue",
       "alert":"HELLO!",
       "sound":"default",
       "badge":7,
       "simple-push":"version=123"
     }'

http://SERVER:PORT/CONTEXT/rest/sender/broadcast

The above sends a broadcast notification to all the different platforms, supported by our server. Using commandline cURL is nice for testing, but for backend applications you usually want a more fluent API. Right now we do have a Java and a Node.js client. A PHP SDK is currently being developed.

To the cloud – and beyond

The AeroGear SimplePush and UnifiedPush server have been bundled in a OpenShift cartridge, so that you can get started in just minutes!

Feedback

We hope you enjoy what we offer and we are looking forward getting feedback, bug reports and feature requests!

Posted in aerogear

What’s new in AeroGear iOS ?

The 1.2.0 version of aerogear-ios contains only one minor change, the deprecation of thelogin: password: success: failure method.

APNs support

With the August release the entire AeroGear focus was around adding Push Notification. Two servers (seeUnifiedPush Server Blog and SimplePush server blog for more details) have been written and we added support to our client platforms (see here for Android/JS) as well!

For the iOS library that obviously means adding support for the Apple Push Notification Service.

Stay standard!

For receiving APNs push notifications there are no extra APIs introduced. The standard Apple APIs work with the AeroGear UnifiedPush server and the our AeroGear Push SDK. For instance, you can use the existing delegate for receiving remote notifications while the application is running, like:

- (void)application:(UIApplication *)application 
  didReceiveRemoteNotification:(NSDictionary *)userInfo {
    // extract desired value from the dictionary...
}

Device Registration

In order to be able to receive push notifications you need to register the iOS device token with a server. The same is true when using the AeroGear UnifiedPush server. The SDK helps you to perform an easy registration:

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

  AGDeviceRegistration *registration = 
    [[AGDeviceRegistration alloc] initWithServerURL:
     [NSURL URLWithString:@"http://YOUR_SERVER/ag-push/"]];

  [registration registerWithClientInfo:^(id<AGClientDeviceInformation> clientInfo) {

    // required fields
    [clientInfo setDeviceToken:deviceToken];
    [clientInfo setVariantID:@"YOUR IOS VARIANT ID"];
    [clientInfo setVariantSecret:@"YOUR IOS VARIANT SECRET"];

    // --optional config--
    UIDevice *currentDevice = [UIDevice currentDevice];
    [clientInfo setOperatingSystem:[currentDevice systemName]];
    [clientInfo setOsVersion:[currentDevice systemVersion]];
    [clientInfo setDeviceType: [currentDevice model]];
    } success:^() {
      NSLog(@"PushEE registration worked");
    } failure:^(NSError *error) {
      NSLog(@"PushEE registration Error: %@", error);
  }];
}

All you need is simply providing the URL of the UnifiedPush server, the deviceToken, the variantIDand the variantSecret.

In the UnifiedPush server when you create an iOS Variant for a PushApplication, the AdminUI does provide the information about the variantID and the variantSecret:

Xcode Template

Our AeroGear Xcode Template has been updated and supports the new Push SDK as well:

Tutorial

Getting started with the APNs is hard, especially with setting up all the Apple related things, like certificates or provisioning profiles. We have create a tutorial that explains the entire workflow, of using the AeroGear UnifiedPush server and the iOS SDK, explained with a simplified demo application.

Check it out!

Feedback welcome

Reach out to us on IRC or our mailing list. Bugs and feature requests are always welcome in our JIRA instance.

Enjoy !

Posted in aerogear

AeroGear iOS 1.1.0 release

Our little iOS library got a new minior release out! Most important part of this release is removing support for iOS 4.3 and now sticking with iOS 5.x and later. While getting this done, we have also updated the underlying AFNetworking library. We are now on the latest 1.3.1 version.

With version 1.1.0 the library now supports HTTP Authentication for Basic and Digest Access Authentication (RFC 2617), by using an NSURLCredential on the Pipe configuration object:

id tasks =
[pipeline pipe:^(id config) {
  [config setName:@"tasks"];

  [config setCredential:[NSURLCredential
     credentialWithUser:@"username"
	 password:@"passwd"
	 persistence:NSURLCredentialPersistenceNone
  ];

}];

On the AeroGear security side, we made the login function a bit more flexible, by accepting a dictionary, so that the user is able to provide the requested parameter names for password or username:

NSDictionary *credentials =
  @{@"username": @"john", @"password": @"123"};

// the login call
[authModole login:credentials success:^(id object) {
  ...
} failure:^(NSError *error) {
  ...
}];

Besides that a little isEmpty method has been added to the AGStore protocol. Finally, for our unit tests we are now using the OHHTTPStubs, when testing all the HTTP parts of the library.

Out side of the “core” library the Xcode Template has been updated to include our OTP library and an optional flag to choose the AeroGear Security module.

The entire release notes:

  • [AGIOS-4] – Add HTTP basic authentication support on AeroGear iOS
  • [AGIOS-5] – Add HTTP digest authentication support on AeroGear iOS
  • [AGIOS-7] – xcode template: include OTP option
  • [AGIOS-8] – Evaluate ARGenericTableViewController for use in the TODO app.
  • [AGIOS-9] – Further improvements of ios unit and mock testing
  • [AGIOS-10] – Update aerogear-ios-xcode template to include Basic/Digest auth options
  • [AGIOS-30] – Integration Tests: Remove (or update) Twitter Pagination tests
  • [AGIOS-32] – AGStore isEmpty method is missing
  • [AGIOS-34] – Update AeroGear-iOS to iOS5+
  • [AGIOS-35] – Update AuthModule for AG-Security
  • [AGIOS-36] – update xcode template guide to reflect 1.1.0
  • [AGIOS-11] – iOS: Evaluate the OHHTTPStubs project

As always, feedback (mailing list or JIRA) is appreciated!

Have fun!

Posted in aerogear

Attending UIKonf

Yesterday I was in Berlin (always worth to go there) for attending the UIKonf: an iOS developers conference. The location (Heimathafen) was awesome! Pretty good atmosphere, and awesome coffee all day. Yay!

The talk line-up was good as well. They had four rounds of sessions. All in one room, and each round had three sessions, that were scheduled to be 30 minutes: Perfect for getting quickly to the point!

The first session was pretty geeky. Joris Kluivers showed the Core Bluetooth Framework and did fancy things with a Mac, an iPhone and an actual lamp :) The second talk (by Boris Buegling) was about the Objective-C Runtime. He showed common things like introspecting objects/methods or associative references. While talking he mention some of the Github Frameworks, like Mantle or libextobjc as good examples. Daniel Eggert gave a pretty basic overview on CoreData. Being a formal Apple employee he gave some hints regarding performance and optimizations. IMO the most interesting statement was given at the end: Do NOT use NSIncrementalStore.

Afterwards I asked and he explained that using remote/http for CoreData just feels wrong. Indeed, I have been there with AFIncrementalStore too! Generally,… I am not that sure on CoreData…, and it looks like that most attendees were also not fans of CoreData :)

Robb gave a cool presentation about another Github Framework, called Reactive Cocoa, which is an Objective-C framework for Functional Reactive Programming: It provides APIs for composing and transforming streams of values. It’s a nice framework, but not 100% sure we really need to integrate it into the AeroGear-iOS library…

Since I am very interested in testing, I really did enjoy Tim Brueckmann‘s talk on “Testing and iOS”. The talk was common sense, IMO and frameworks like Kiwi (for BDD) or OCUnit got mentioned. One thing I took away was OHHTTPStubs. Currently we have our own “NSURLProtocol” impl, so that may go away :)

Another talk, by Florian Kugler, was on tooling/instruments. He showed how these tools can be used to find memory leaks and other issues with your code. A few talks were on Design and User Interaction. It’s not really my topic, but it was also not that bad :) The last talk given by Peter Steinberg was about tricks in your code, including some impressive reverse engineering.

The afterparty was at the Edelweiss bar/restaurant. With a few cold drinks the discussions continued all night long. Funny fact: a few mentioned their desire for something like generics, which I totally agree with!

For me it was a win, attending the conference. Various chats with folks that are longer doing iOS development was helpful, in kinda understanding that community. Also seeing we are using the right tools and libraries was good :) I think, it was also a bit interesting, that there were no talks on popular frameworks like AFNetworking or CocoaPods.

Thanks to Chris Eidhof et al. for running such a great conference. I will come back :)

Posted in Uncategorized

Confess Vienna

Last week I was attending the Confess Conference in Vienna. It was a pretty good conference with interesting attendees and talks. Most talks were in the “Enterprise Java” range (Java EE and Spring); added with content around Big-Data, and JavaScript/HTML(5).

I gave a presentation about using HTML/JavaScript bits with a RESTful JavaEE backend (meaning JAX-RS). It was an overview on different frameworks/libraries out there, demonstrated on-top of the AeroGear TODO backend demo:

  • jQuery / jQuery Mobile
  • Backbone.js
  • AeroGear.js
  • Angular.js

The client demo applications where executed in three different “containers”:

  • desktop browser
  • mobile browser (iOS simulator)
  • Apache Cordova application (iOS simulator)

For the last demo, I showed our new AeroGear plugin for JBoss Forge (details here). It basically generates a JavaEE application, which uses Angular.js (for view templates and model declaration) and AeroGear.js (for the HTTP communication) as it’s Web technology.

Once the app is deployed it can be used in a (mobile) browser. The really cool part is that the HTML/JS bits from the generated app can be used as a native mobile app, by using Apache Cordova’s CLI with just a few steps! (A blog entry will follow…)

Going was worth it and seeing old friends is always fun. Thanks to Irian for having me at Confess! My slides are here: http://people.apache.org/~matzew/Confess_2013

Posted in aerogear

AeroGear iOS 1.0.0

Today the AeroGear team is very happy to announce the 1.0.0 release of our iOS libraries:

The aerogear-ios project is a utility to communicate with remote server and storing data. The functionality of the library covers these areas:

  • HTTP REST abstraction + Paging
  • Authentication and User enrollment
  • Store and DataManager

TODO application was built that shows the library, by communicating with our TODO application, on OpenShift.

AeroGear meets Security

The aerogear-otp-ios project contains an iOS library for generating one time passwords according to RFC 6238. My colleague Christos Vasilakis describes the library here. Feel free to give the little demo a try as well!

More Documentation and Xcode Template

Besides the libraries there are more goodies! The project offers a neat template for Xcode, to kickstart your development.Check it out! We also increased the documentation with a little Cookbook

We hope you enjoy this release. We strongly encourage you to help us improving the project with feedback on the mailing list, or via our JIRA instance

Posted in aerogear

AeroGear 1.0.0 – Candidate Release 1

Today we released our CR1!

So, what’s new in iOS?

With the new 1.0.0.CR1 release, we continued to focus on stabilisation! Besides adding more tests and maintainance, we have improved existing APIs and added a few new features.

The AGStore protocol is now allowing you to apply filterings, by using the NSPredicate class (see here).

The AGPipe protocol has a cancel (see here) to cancel running requests and its configuration is now aware of applying a timeout interval.

Besides that, the OTP demo has been polished to run against a JSON-based backend.

The library can be found on CocoaPods! Enjoy!

As always, feedback is more than welcome!

Posted in aerogear
Follow

Get every new post delivered to your Inbox.

Join 32 other followers