Kin
Kin

Reputation: 35

Tizen is not defined? Trying to create alarm

When I run in the simulator it works, but in tablets, smartphones, etc., I get "Reference Error - Tizen is not defined."

My main:

//Initialize function
var init = function () {
// TODO:: Do your initialization job
console.log("init() called");

// add eventListener for tizenhwkey
document.addEventListener('tizenhwkey', function(e) {
    if(e.keyName == "back") {
        alert(tizen.application);
        tizen.application.getCurrentApplication().exit();
    }
});


notificationMe = function () {
    try {
        console.log(tizen.application);
        window.tizen.alarm.removeAll();
        var appControl = new             window.tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
        var alarm = new window.tizen.AlarmAbsolute(new Date(2014, 1, 27, 10, 20));
        window.tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
        alert('Prepare to Tizen Alert');
        alert(alarm.getNextScheduledDate()+" - "+window.tizen.alarm.getAll().length);
    } catch(err) {
        alert(err.name+" : "+err.message);
    }
}

};
$(document).ready(init);

config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"     id="http://yourdomain/Alarm" version="1.0.0" viewmodes="maximized">
    <tizen:application id="___ID_OCULTED__" package="__OCULTED__" required_version="2.0"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/api/tizen"/>
    <feature name="http://tizen.org/api/application"/>
    <feature name="http://tizen.org/api/application.kill"/>
    <feature name="http://tizen.org/api/application.launch"/>
    <feature name="http://tizen.org/api/application.read"/>
    <feature name="http://tizen.org/api/alarm"/>
    <feature name="http://tizen.org/api/alarm.read"/>
    <feature name="http://tizen.org/api/alarm.write"/>
    <icon src="icon.png"/>
    <name>Alarm</name>
    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
    <tizen:privilege name="http://tizen.org/privilege/alarm"/>
    <tizen:privilege name="http://tizen.org/privilege/notification"/>
    <tizen:privilege name="http://tizen.org/privilege/application.read"/>
    <tizen:privilege name="http://tizen.org/privilege/application.info"/>
    <tizen:setting screen-orientation="portrait" context-menu="enable" background-    support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>

</widget>

Any suggestions? I tried tizen, window.tizen ... no effect on tables, smartphones, but in the simulator it still work.

Upvotes: 0

Views: 3092

Answers (3)

Tima Root
Tima Root

Reputation: 11

Just disable checkbutton "Enable Live Editing" in "Run Configurations" menu (rigth click on project -> "Run as" -> "Run configurations...")

P.S. The same problem in: Tizen SDK: Can't find variable: tizen

Upvotes: 1

Konstantin
Konstantin

Reputation: 340

Most probably you're running that on devices that doesn't support Tizen.

Even now there's only a handful of devices that support Tizen.

I know only Samsung smartwatches Gear 1 & 2 & S and "experimental" smartphone Samsung Z1.

Upvotes: 0

m.wasowski
m.wasowski

Reputation: 6386

Check for tizen object in js console. If it is undefined, reinstall wrt-plugins-tizen packages.

Logs from js console (debug) would be helpful...

Upvotes: 0

Related Questions