In a Gear 2 consumer/provider app, how should the consumer app use the settings contained in settings.xml
?
The Tizen documentation shows how to set up settings such that the Gear Manager will have an icon and page for the consumer app's settings, but it isn't clear on how to relate the contents of the settings.xml
with the app itself.
e.g. Sample settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<Application xmlns:android="http://schemas.android.com/apk/res/android" type="application" version="001" language="english">
<packageName>languages0</packageName>
<DisplayName>@setting</DisplayName>
<Settings>
<Item id="radiobox" title_type="title_subtitle" setting_type="radiobox">
<Title>@radiobox</Title>
<SubTitle options="radiobox">White</SubTitle>
<Radiobox id="radiobox" number="5" selected="1">
<RadioboxItem>White</RadioboxItem>
<RadioboxItem>Red</RadioboxItem>
<RadioboxItem>Blue</RadioboxItem>
<RadioboxItem>Green</RadioboxItem>
<RadioboxItem>Yellow</RadioboxItem>
</Radiobox>
</Item>
</Settings>
</Application>
So - how does this item actually related to the objects in index.html
/ main.js
?
There is provided sample code on how to parse the updatedsettings.xml
:
function readUpdatedSetting(doSetting)
{
if(!doSetting)
return;
var path = "wgt-private/updatedsettings.xml";
tizen.filesystem.resolve(path, function(file)
{
file.readAsText(function(text)
{
doSetting((new DOMParser()).parseFromString(text, "text/xml"));
});
file.parent.deleteFile(path);
});
}
However I'm unsure as to how doSetting
is used or meant to be used. Should I create my own DOMparser
function or is there already a way within the SDK?