I am in the process of writing my first Android Cordova app using OneSignal for Push notifications. The process of setting up OneSignal and enabling Cloud Messaging on Google turned out to be remarkably easy. With that done I proceeded to create a simple jQuery Mobile Cordova app and modified the init
function app.js
function init()
{
window.plugins.OneSignal.setLogLevel({logLevel:4,visualLevel:4});
var notificationOpenedCallback = function(jsonData) {
alert(JSON.stringify(jsonData));
window.plugins.OneSignal.enableVibrate(true);
window.plugins.OneSignal.enableSound(true);
};
window.plugins.OneSignal.init('one-signal-id', {googleProjectNumber: 'project no'}, notificationOpenedCallback); }
Having built the APK I installed it on my Android device and got two INFO messages - one from Google and one from OneSignal. I am assuming that this is because I have a debug build with the loglevel set to 4.
I then proceeded to send out a push via OneSignal. The message appears in the Sent messages list. However, nothing whatsoever happens on my phone - I had expected it to vibrate at the very least.
Also, I would like to hook into the notificationOpened event. It is not clear from the OneSignal docs how this should be done. I am into my first hour with OneSignal and push notifications so I am assuming that I am overlooking something here. I'd be grateful to anyone who might be able to put me on the righ track.