Skip to content

Instantly share code, notes, and snippets.

lib/sync.js - Intercepting request for dataset myShoppingList with params { query_params: {},
meta_data:
{ metaData:
{ 'vRa/5GE9Cl0nTJdtExng/ooN9RU=': [Object],
'PUjS8g7NdsYFxRYEVbi7jfO3HeY=': [Object] } } }
lib/sync.js - Intercepting request for dataset myShoppingList with params { query_params: {},
meta_data:
{ metaData:
{ 'vRa/5GE9Cl0nTJdtExng/ooN9RU=': [Object],
'PUjS8g7NdsYFxRYEVbi7jfO3HeY=': [Object] } } }
bindEvents: function () {
document.addEventListener('deviceready', this.register, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
register: function () {
function successHandler() {
app.clearMessages();

In the Appforms-Template-v3 folder execute:

$ cordova create cordova --link-to www

Then add the following to the config.xml:

 

Updating the plugins

Update all the plugins to their latest version, things we need to look at test:

  1. used cordova-plugin-screen-orientation in favour of fh-cordova-plugin-orientation
// This changes the javascript API a bit from:
deviceOrientation.setOrientation("portrait", success, fail);
// to:
(function() {
var childProcess = require("child_process");
var oldSpawn = childProcess.spawn;
function mySpawn() {
console.log('spawn called');
console.log(arguments);
var result = oldSpawn.apply(this, arguments);
return result;
}
childProcess.spawn = mySpawn;

test:

$> npm install cordova -g

bla

<?xml version='1.0' encoding='utf-8'?>
<widget id="[app id]" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
/AndroidRuntime( 3221): com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT
E/AndroidRuntime( 3221): at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
E/AndroidRuntime( 3221): at com.google.gson.Gson.fromJson(Gson.java:795)
E/AndroidRuntime( 3221): at com.google.gson.Gson.fromJson(Gson.java:859)
E/AndroidRuntime( 3221): at com.google.gson.Gson.fromJson(Gson.java:832)
E/AndroidRuntime( 3221): at org.jboss.aerogear.android.store.sql.SQLStore.readAll(SQLStore.java:111)
E/AndroidRuntime( 3221): at org.jboss.aerogear.cordova.push.NotificationMessageHandler.createNotification(NotificationMessageHandler.java:95)
E/AndroidRuntime( 3221): at org.jboss.aerogear.cordova.push.NotificationMessageHandler.onMessage(NotificationMessageHandler.java:56)
E/AndroidRuntime( 3221): at org.jboss.aerogear.android.unifiedpush.RegistrarManager$2.run(RegistrarManager.java:183)
E/AndroidRuntime( 3221): at java.
{
"aerogearPushId":"84a4db43-f8db-4d43-840a-ef58186cfbef",
"alert":"123",
"badge":-1,
"id":"d7ca1a27-57c9-4a06-a557-9aaff6ec67e2",
"sound":"default",
"userData":{
"collapse_key":"do_not_collapse",
"from":"353255020007",
"google.message_id":"0:1473149230998087%f6a80efcf9fd7ecd"
var websocketClient = new MessageWebSocketRx();
var subscribeToMessagesReceived = websocketClient.ObserveTextMessagesReceived.Subscribe(
    msg =>
    {
        Debug.WriteLine($"Reply from test server: {msg}");
    });

var cts = new CancellationTokenSource();