Languages

Menu
Sites
Language
Cordova features are not working

I created a new tizen wearable project using Basic template.

Here is my config.xml. Note the requried_version="5.5" (which is higher than 3.0 as stated in the docs) and filesystem.read privilege (as docs state that it is also requried for accessing cordova features).

<?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/BasicUI" version="1.0.0" viewmodes="maximized">
    <tizen:application id="YvmUHXsqCI.BasicUI" package="YvmUHXsqCI" required_version="5.5"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <icon src="icon.png"/>
    <name>BasicUI</name>
    <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
    <tizen:profile name="wearable"/>
    <tizen:setting background-support="disable" encryption="disable" hwkey-event="enable"/>
</widget>

Here is my main.js


window.onload = function () {
    document.addEventListener('deviceready', onDeviceReady, false);

	function onDeviceReady() {
	    console.log('Cordova features now available');
	    console.log('Cordova version: ' + device.cordova);
	    console.log('Model name: ' + device.model);
	    console.log('Platform: ' + device.platform);
	    console.log('OS version: ' + device.version);
	    console.log('Device UUID: ' + device.uuid);
	}

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

    // Sample code
    var textbox = document.querySelector('.contents');
    textbox.addEventListener("click", function(){
    	box = document.querySelector('#textbox');
    	box.innerHTML = box.innerHTML == "Basic" ? "Sample" : "Basic";
    });
    
};

The issue is that deviceready event is not called. window.device also does not become available.

Is it possible to query cordova device info?

Responses

1 Replies
Francisc Ungureanu

Hi @Egor, have you found any solutions to this issue ?