Skip to content

Instantly share code, notes, and snippets.

View sebastienblanc's full-sized avatar

Sebastien Blanc sebastienblanc

View GitHub Profile
'use strict';
angular.module('newadminApp' ).
value('version', '0.1');
newadminApp.factory('pushApplication', function($resource) {
return $resource('/rest/applications/:appId', {
appId : '@appId'
}, {
get : {

helloworld-push-<ios/android/cordova>: Basic Mobile Application showing the AeroGear Push feature

Author:
Level: Beginner
Technologies: ,<javaScript/cordova>,
Summary: A basic example of Push : Registration and receiving messages.
Target Product: Mobile
Product Versions: EAP 6.1, EAP 6.2, EAP 6.3
Source: https://github.com/jboss-developer/jboss-mobile-quickstarts

(function() {
var mailEndpoint, mailRequest, newsEndpoint, newsRequest, SPClient, UPClient;
// config params for UnifiedPush server
var variantId = "5ff0de96-0f50-4e1f-8e35-902ca843beba";
var variantSecret = "4d84742a-1e00-42dd-9973-7b72391b2c8b";
var simplePushUrl = "https://hackergartenups-sblanc.rhcloud.com:8443/simplepush";
var unifiedPushUrl = "https://hackergartenups-sblanc.rhcloud.com";
// create the 'UnifiedPush' client object:
curl -3 -u "a0f6a30e-0cda-49a4-9901-bcfdc30e5c7a:b986c86e-4092-4728-a1ed-7ac68f6d0f7a" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"categories" :["mail"],
"simple-push": "version=1111"
}' https://hackergartenups-sblanc.rhcloud.com/rest/sender
curl -3 -u "a0f6a30e-0cda-49a4-9901-bcfdc30e5c7a:b986c86e-4092-4728-a1ed-7ac68f6d0f7a" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"categories" :["news"],
var websocket = new WebSocket("wss://hackergartenups-sblanc.rhcloud.com:8443/simplepush/websocket");
websocket.onopen = function(event) {alert("OPEN");};
websocket.onclose = function(e) {alert('closed')};
websocket.onmessage = function(e) {console.log(e.data); };
var helloMsg = {messageType: "hello",uaid: "",channelIDs: []};
websocket.send(JSON.stringify( helloMsg ));
curl -3 -u "6438d41f-8738-42e5-9d1f-d3539cd4a2c4:cb519bdb-adea-4140-bc94-c75f459693c1" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"message": {
"alert":"HELLO!"
},
"alias" : ["bob"]
}' https://sblancpush-sblanc.rhcloud.com/rest/sender

Send Push Notifications to your Connected Objects from your JEE Application

Push notifications, a key feature of every mobile operating system, allow you to quickly reach your mobile users. But beyond these devices we have today more and more connected objects (IoT) that also can receive these notifications. In this session, we’ll discuss how to implement push notifications for connected objects (and Mobile Devices) including how to integrate it into your JEE Application.

The AeroGear UnifiedPush Server is an open source solution that provides an unified API for mobile operating systems, like iOS and Android but that also supports Mozilla's Simple Push Protocol along with a Java Client Library, allowing every connected object running the JVM, like the RaspBerry Pi or Lego Mindstorms, to receive Push Notifications.

Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: /home/sebastien/apps/apache-maven-3.1.1
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.10-200.fc19.x86_64", arch: "amd64", family: "unix"

Building a multiplatform clone of WhatsApp with Cordova and Eclipse Thym

Apache Cordova (AKA Phonegap) is the de-facto standard runtime environment for developing hybrid mobile applications. Red Hat JBoss Developer Studio has recently added new features to ease the development of cross-platform mobile applications using Apache Cordova : The Thym (The HYbrid Mobile) project delivers IDE components and a framework for developing Hybrid Mobile Applications on the Eclipse platform.

In this session, Sebastien Blanc will discuss the principles of building hybrid mobile applications and demonstrate how Eclipse Thym can ease the task. Demos will include:

  • A complete development cycle for a hybrid mobile application.
  • Creating a project, editing it, then running it on platform emulators without leaving the integrated development environment (IDE).
  • Integrating it with a backend Application.
After a short introduction to the AeroGear project, we will quickly dive into the concept of Push Notifications starting by presentating the different existing Push Networks :
-APNs from Apple
- GCM from Google
- SimplePush from Mozilla. We will focus a bit more on this protocol by showing how flexible it is and how Connected Objects can easily implement this. We will show some use cases where IoT (Internet of Things) can benefit from Push Notifications : connected fridge, Surveillance infrastructures.
From there, we will explain the challenges to integrate these differents technologies with your connected client applications and your business logic, in particular JEE applications.
This will lead us to introduce the UnifiedPush Server, an Open Source project (http://aerogear.org/push/) , 100% Java, that centralizes the handling of the Push Notifications by :
- Hanlding the registrations of your clients and submitting the Push Notifications to the appropriate Vendor Push Networks
- Providing mobile clie