Skip to content

Instantly share code, notes, and snippets.

Building mobile apps with AeroGear and Cordova

Mobile devices are increasingly important as a platform. The number of different devices on the market increases every day. This posses a challenge, how do we support all of them. Every new device comes with it's own paradigms and programming language. Wouldn't it be great if we could create one application that could support all platforms. With Cordova and AeroGear you can.

Cordova is a platform that allows you to access native device functions from JavaScript enabling you to create mobile applications with just CSS, HTML and JavaScript, for all platforms. You can use your existing skill sets to create native applications.

AeroGear, has created native libraries that to develop mobile apps rapidly, but we also support Cordova. So now you can create enterprise grade mobile applications with AeroGear together with Cordova. With support for encrypted databases and one time password Push notifications and much more.

onDeviceReady: function () {
var params = {
callback: 'onGeofenceEvent',
notifyMessage: '%2$s your home!'
};
//register the application to get geofencing events in the onGeofenceEvent function
geofencing.register(params);
}
var params = {"fid": 2, "radius": 100, "latitude": 47.351440, "longitude": 8.354737};
geofencing.addRegion(
function() {
console.log("region added");
},
function(e) {
alert(e);
}, params
);
//Password based key derivation support (PBKDF2)
AeroGear.Crypto().deriveKey( function(password) {
console.log(password);
}, errorHandler, PASSWORD );
//Symmetric encryption support (GCM)
//Encryption:
var agCrypto = new AeroGear.Crypto();
agCrypto.deriveKey( function(rawPassword) {
var options = {
agCrypto.getRandomValue({
success: function (generatedIV) {
agCrypto.deriveKey({
password: 'my password',
success: function (rawPassword) {
agCrypto.encrypt({
options: {
IV: generatedIV,
key: rawPassword,
data: "My Bonnie lies over the ocean, my Bonnie lies over the sea"
agCrypto.deriveKey('my password').then(function(rawPassword) {
return agCrypto.getRandomValue();
}).then(function(generatedIV) {
return agCrypto.encrypt({
IV: generatedIV,
key: rawPassword,
data: "My Bonnie lies over the ocean, my Bonnie lies over the sea"
});
}).then(function(cipherText) {
console.log(cipherText);
@edewit
edewit / sync.java
Last active December 30, 2015 05:39
// [option 1 fully automatic we create a pipe and add the posibilty to add a store for failover and sync just happens at on- and offline events]
// and because merging can fail users can add a conflict handlers
Builder builder = Builder.createPipe(pipeConfig).addFailoverStore(storeConfig);
Pipe<Car> pipe = builder.pipe(Car.class);
pipe.addConfictHandler(new ConflictHandler() {
public void conflict(Field originalField, Field newField) {
// user interaction
}

Building mobile apps with AeroGear and Cordova

Mobile devices are increasingly important, and the number of different devices continues to grow. How do we support all of them? New devices often come with their own development platforms. Wouldn't it be great if we could create one application supported by all platforms? Enter Cordova and AeroGear.

Cordova allows you to access native device functions to create mobile applications for all platforms using just CSS, HTML, and JavaScript. So, you can use your existing skills to create native applications.

AeroGear has native libraries that help you rapidly develop mobile apps, while also supporting Cordova. With support for encrypted databases and one-time password push notifications, and much more, you can create enterprise worthy mobile applications with AeroGear together with Cordova.

In this session, you’ll learn:

@edewit
edewit / Usage.java
Last active January 3, 2016 05:59
Usage Java simple push client
SimplePushClient client = new SimplePushClient("ws://localhost:7777/simplepush/websocket");
client.connect();
client.register(new RegistrationListener() {
@Override
public void onRegistered(String channelId, String simplePushEndPoint) {
}
});
...
public void onRegistered(String channelId, String simplePushEndPoint) {
final PushConfig config = new PushConfig();
config.setDeviceToken(channelId);
config.setSimplePushEndpoint(simplePushEndPoint);
unifiedPushClient.register(config);
}