Languages

Menu
Sites
Language
Problem with calling REST API on Emulator and TV

Hi Guys,

 

I'm developing an TIZEN application for TV and I have problem with calling an rest api.

 

Actually the calling is working fine on Web Simulator BUT, when I test the very same code on Emulator in debuging or in just running mode I got no response from the REST API

 

I have tried calling a different API calls to check if that is the problem but is not that. Also I tried different methods for calling like XMLHttpRequest and jquery get method, same results.

Could you please tell me why this is happening and how to fix it.

 

Or if you have any sample code with calling an external rest api that works on emulator please share

View Selected Answer

Responses

4 Replies
Marco Buettner

Share your config.xml ... I guess your forget to setup the privileges and network access

Zlatko Ristevski

Hi Marco,

 

Thanks for reply.

 

My config.xml is same as it cames from the blank template.

 

Here it is:

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="http://yourdomain/BasicapplicationTest" version="1.0.0" viewmodes="maximized">
    <tizen:application id="qrOHwmuuAk.BasicapplicationTest" package="qrOHwmuuAk" required_version="2.3"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <icon src="icon.png"/>
    <name>BasicapplicationTest</name>
    <tizen:profile name="tv"/>
</widget>

 

Mark as answer
Iqbal Hossain

Hi~

Please add below privilege and policy in your config.xml as it's required. 

<tizen:privilege name="tizen.org/privilege/internet"/>
<access origin="*" subdomains="true"/>

By adding privilege, it allows the application to access the Internet. This privilege is for both native and Web application.

By <access> element in config.xml Developers can specify protocols, domains, and sub-domains.

Hope it will solve your problem. 

Zlatko Ristevski

Hi Iqbal,

 

Thanks, this actually worked.