Skip to content

Instantly share code, notes, and snippets.

@corinnekrych
Created February 14, 2014 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corinnekrych/9000652 to your computer and use it in GitHub Desktop.
Save corinnekrych/9000652 to your computer and use it in GitHub Desktop.
onDeviceReady: function() {
app.receivedEvent('deviceready');
console.log(':::::::::::::::::::::::::::::::::::::::::DEVICE READY');
var pushConfig = {
// senderID is only used in the Android/GCM case
senderID: "107028882733",
pushServerURL: "https://judconpush-sblanc.rhcloud.com/",
variantID: "d366b4df-a9bc-4a16-a4f2-8884d094cc19",
variantSecret: "XXXXXXX",
alias: "corinne"
}
//badge and sound are iOS specific, and ignored on Android
push.register(successHandler, errorHandler, {"badge": "true", "sound": "true",
"ecb": "onNotification", pushConfig: pushConfig});
function successHandler() {
console.log(':::::::::::::::::::::::::::::::::::::::::success');
}
function errorHandler(message) {
console.log('::::::::::::::::::::::::::::::::::::::::::error ' + message);
}
function onNotification(e) {
alert(e.alert);
}
},
Got the error:
D/CordovaLog( 9315): file:///android_asset/www/js/index.js: Line 39 : :::::::::::::::::::::::::::::::::::::::::DEVICE READY
I/Web Console( 9315): :::::::::::::::::::::::::::::::::::::::::DEVICE READY at file:///android_asset/www/js/index.js:39
V/PushPlugin( 9315): execute: action=register
V/PushPlugin( 9315): execute: data=[{"pushConfig":{"senderID":"107028882733","variantID":"d366b4df-a9bc-4a16-a4f2-8884d094cc19","variantSecret":"d565cace-ab1b-4898-b4a6-f5ddf4242135","alias":"corinne","pushServerURL":"https:\/\/judconpush-sblanc.rhcloud.com\/"},"ecb":"onNotification","sound":"true","badge":"true"}]
V/PushPlugin( 9315): execute: jo={"pushConfig":{"senderID":"107028882733","variantID":"d366b4df-a9bc-4a16-a4f2-8884d094cc19","variantSecret":"d565cace-ab1b-4898-b4a6-f5ddf4242135","alias":"corinne","pushServerURL":"https:\/\/judconpush-sblanc.rhcloud.com\/"},"ecb":"onNotification","sound":"true","badge":"true"}
V/PushPlugin( 9315): execute: ECB=onNotification
D/dalvikvm( 9315): GC_CONCURRENT freed 249K, 52% free 2757K/5639K, external 416K/542K, paused 2ms+2ms
W/PluginManager( 9315): THREAD WARNING: exec() call to PushPlugin.register blocked the main thread for 56ms. Plugin should use CordovaInterface.getThreadPool().
I/System.out( 9315): =====> SHOW_RECT_MSG_ID scrollTo 0, 0
I/System.out( 9315): old scrollTo
W/dalvikvm( 9315): Exception Ljava/lang/RuntimeException; thrown while initializing Landroid/os/AsyncTask;
W/dalvikvm( 9315): threadid=14: thread exiting with uncaught exception (group=0x40015578)
E/AndroidRuntime( 9315): FATAL EXCEPTION: pool-1-thread-1
E/AndroidRuntime( 9315): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 9315): at org.jboss.aerogear.android.impl.unifiedpush.AeroGearGCMPushRegistrar.register(AeroGearGCMPushRegistrar.java:90)
E/AndroidRuntime( 9315): at org.jboss.aerogear.cordova.push.PushPlugin.register(PushPlugin.java:156)
E/AndroidRuntime( 9315): at org.jboss.aerogear.cordova.push.PushPlugin.access$000(PushPlugin.java:43)
E/AndroidRuntime( 9315): at org.jboss.aerogear.cordova.push.PushPlugin$1.run(PushPlugin.java:110)
E/AndroidRuntime( 9315): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
E/AndroidRuntime( 9315): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
E/AndroidRuntime( 9315): at java.lang.Thread.run(Thread.java:1019)
E/AndroidRuntime( 9315): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 9315): at android.os.Handler.<init>(Handler.java:121)
E/AndroidRuntime( 9315): at android.os.AsyncTask$InternalHandler.<init>(AsyncTask.java:421)
E/AndroidRuntime( 9315): at android.os.AsyncTask$InternalHandler.<init>(AsyncTask.java:421)
E/AndroidRuntime( 9315): at android.os.AsyncTask.<clinit>(AsyncTask.java:152)
E/AndroidRuntime( 9315): ... 7 more
D/szipinf ( 2989): Initializing inflate state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment