Languages

Menu
Sites
Language
[Gear S] internet access

Tell me, please, why the application (on Gear) does not respond to requests? 

$ .get ('https://google.com', {}, function (data) {
console.log (data); 
}); 

nothing happens. 

in tizen mobile app I added the following lines in the config 
<access origin = "*" subdomains = "true"> </ access> 
<tizen: allow-navigation> * </ tizen: allow-navigation> 
  
and began to work 

Edited by: John Ixion on 22 Sep, 2014

Responses

5 Replies
Marco Buettner

Paste your config.xml and with gear you want to create a internet connection? Only Gear S has a standalone internet connection.

Ivanoc

Yes, Gear S

I use Tizen SDK for Wearable 1.0.0 b3
http://developer.samsung.com/samsung-gear

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://site.me/app" version="1.0.0" viewmodes="maximized">
    <!-- <access origin="*" subdomains="true"></access>
    <tizen:allow-navigation>*</tizen:allow-navigation> -->
    <tizen:application id="1LuUn3NVnN.test2" package="1LuUn3NVnN" required_version="2.2"/>
    <content src="login.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <icon src="app.png"/>
    <name>APP</name>
</widget>

Marco Buettner

I got only a warning not fatal error like you shown... "*" is a malformed url and its correct... Well-formed url have Protocolschema (exp: http), host (exp: google.com, 192.168.0.1)

Ivanoc

i added 
<tizen: content-security-policy> script-src 'self' </ tizen: content-security-policy> 

<? xml version = "1.0" encoding = "UTF-8"?> 
<widget xmlns = "http://www.w3.org/ns/widgets" xmlns: tizen = "http://tizen.org/ns/widgets" id = "http://site.me/app" version = "1.0.0" viewmodes = "maximized"> 
     <tizen: content-security-policy> script-src 'self' </ tizen: content-security-policy> 
     <tizen: application id = "1LuUn3NVnN.test2" package = "1LuUn3NVnN" required_version = "2.2" /> 
     <content src = "login.html" /> 
     <feature name = "http://tizen.org/feature/screen.size.all" /> 
     <icon src = "app.png" /> 
     <name> APP </ name> 
</ widget> 

Now when I do a query:

login.html (17): Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'".

Stephan König

Hi Ivanoc,

you may have to add privilige for internet and feature network.wifi to be sure to have access to internet.
Also you should not use * for access origin, just allow url's you realy use.

So your config.xml should look like simmiliar to this example:

<?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/test" version="1.0.0" viewmodes="maximized">
    <access origin="http://test.com" subdomains="true"/>
    <tizen:application id="r2Svs8vdaf.test" package="r2Svs8vdaf" required_version="1.0"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.normal.320.320"/>
    <feature name="http://tizen.org/feature/network.wifi"/>
    <icon src="icon.png"/>
    <name>test</name>
    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
    <tizen:setting hwkey-event="enable"/>
</widget>

With this features/priviliges it works fine for me on a gear S devices.

Additional you may have to flash an actual firmware to have latest webapp api's.