1

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?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
AndyOS
  • 3,607
  • 3
  • 23
  • 31
  • Are you able to get the Tizen IDE to even validate your settings.xml? It's failing mine with a message of "Cannot find the declaration of element 'Application'." – Sterling Jun 19 '14 at 19:46
  • @String, yes - Clean the project and it'll remove the errors – AndyOS Jun 19 '14 at 20:31

2 Answers2

0

As evidenced by my comment above, I haven't gotten far enough to verify this myself, but...

DOMparser should be built into the web API, as it's essentially running in a browser, right? Here's doumentation at Mozilla, but AFAIK all "browsers" are complient in this regard. https://developer.mozilla.org/en-US/docs/Web/API/DOMParser

Sterling
  • 6,365
  • 2
  • 32
  • 40
  • Yeah, I figure I can use a parser - but I'm trying to find out is there something already in the api that I can use – AndyOS Jun 19 '14 at 20:34
0

Samsung has recently released a new API documentation how to use the settings.xml to create both basic and complex settings for your Gear 2 apps. More can be found here .. http://denvycom.com/blog/tizen-wearable-api-documentation-v1/

The API documentation itself can be directly downloaded from here http://img-developer.samsung.com/contents/cmm/SamsungGearApplication_Programming_Guide_1.0_140723.pdf

Vykthur D .
  • 351
  • 2
  • 7