I have been following this guide to setup the push notifications on Tizen Wear. Here's the code I've used thus far:
window.onload = function() {
// add eventListener for tizenhwkey
document.addEventListener('tizenhwkey', function(e) {
console.log("used key: " + e.keyName)
if(e.keyName === "back") {
try {
tizen.application.getCurrentApplication().exit();
} catch (ignore) {
console.log(ignore);
}
}
});
registerPushService();
};
function registerPushService() {
tizen.push.connect(stateChangeCallback, notificationCallback, registerError);
}
function stateChangeCallback(state) {
console.log('The state is changed to: ' + state);
if (state === 'UNREGISTERED') {
tizen.push.register(registerSuccess, registerError);
}
}
function registerSuccess(id) {
console.log('Push registration successful, id: ' + id);
}
function registerError(response) {
console.log('Register error: ' + response.name);
}
function notificationCallback() {
console.log('Notification arrived');
document.querySelector('.contents').classList.toggle('selected');
}
I have also added the following to condif.xml:
<feature name="http://tizen.org/feature/network.push"/> <tizen:privilege name="http://tizen.org/privilege/push"/>
And still, when launching on the chrome instance I get "Cannot read property 'connect' of undefined" on call to "tizen.push.connect()". Is there anything else that needs to be done when trying to use push notifications?