Reputation: 543
I followed the steps given in below link.
But I am unable to register for Push Notification while logging in.
function registerDeviceForMCSPush(mcsBackend) {
var defer = $.Deferred();
if (typeof PushNotification !== 'undefined') {
try {
var push = PushNotification.init({
"android": {
// TODO replace Google Project Number here
senderID: "55926"
}
});
push.on('registration', function (data) {
var regId = data.registrationId;
deviceHandshakeforCordova(mcsBackend, regId);
});
push.on('notification', function (data) {
alert("Push Notification from Oracle MCS: " + data.message);
});
push.on('error', function (e) {
alert("Push Notification Error=" + e.message);
});
} catch (ex) {
alert("Error registering device with MCS" + ex);
defer.reject();
}
} else {
alert("PushNotification NOT Defined!");
defer.reject();
}
return $.when(defer);
}
I receive the alert message "Push Notification is not defined" from the code
Upvotes: 0
Views: 297
Reputation: 445
Oracle JET based on Cordova doesn't come with push notifications out of the box, rather it's typical to add a 3rd party Cordova plugin such as https://github.com/phonegap/phonegap-plugin-push. I suspect the error you're getting is indicating you haven't added the 3rd party plugin.
You add this to your JET project by
a) cd'ing into your application directory then cd'ing into the hybrid directory
b) executing the following command:
cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXXX"
...where XXXXXXX maps to the project number in the Firebase developer console.
This video explains the complete set of steps for setting up push notifications in JET with Oracle Mobile Cloud Service inline with the steps from the article and should provide you assistance in learning how it all works: https://youtu.be/6n-1-bo2_iQ
Upvotes: 0