언어 설정

Menu
Sites
Language
Widget | Internet access via bluetooth connection

Hi, I have created my first .net widget. It is a simple widget with a button that makes an https post request to a server and it opens my garage door.

Although it works perfectly when I am connected over the WiFi, using the bluetooth it throws imediatelly an exception telling "An error occured while sending the request".

It seems that my widget cannot get access to the internet at all when I am connected using the bluetooth. However, at the same time, other applications such as the weather app can download conetent from the internet using the bluetooth connection with my phone. 

Is there any way to resovle this issue ?

Thanks!

Edited by: Dimitris Petridis on 18 4월, 2019
답변 바로가기

Responses

5 댓글
Mark as answer
Juwon(Julia) Ahn

Hi 

Geting access to the Internet "using bluetooth" means that your watch is paired with the mobile phone via BT connection and it tries to access to the Internet ??

Am I right? If not, please explain the details.

If a standalone app(or widget) wants to send/receive http/https data packets when the watch is paired with mobile phone which has data connectivity, 

we can use "webproxy".

To show hot to use WebProxy, I update the sample WidgetApp. Please check the below sample app.

https://github.com/Samsung/Tizen-CSharp-Samples/tree/master/Wearable/WidgetSample/src   (Btn_Clicked() in MyFirstWidget.cs file)

I think you can figure out how to use HttpWebRequest with WebProxy to get data.

Please feel free to reach out if you have any further questions.

 

 

Dimitris Petridis

Hi Julia..

You explained exactly what I wanted, I used the webproxy and it worked perfectly. 

I realy apreciate your immediate help in resolving the problem. 

Thank you very much.

M Bright

Hi!

I'm having trouble connecting to a rest api from my app with HttpClient usin WebProxy.
It works fine when wifi is enabled on Gear. When connected to phone via bluetooth and wifi disabled the client request fails.

The implementation looks like:

if (currentConnection.Type == ConnectionType.Ethernet)
{
    string proxyAddr = ConnectionManager.GetProxy(AddressFamily.IPv4);

    var handler = new HttpClientHandler
    {
        UseProxy = true,
        Proxy = new WebProxy(proxyAddr, true)
    };    
    client = new HttpClient(handler);
}

Am I missing some fundamental part here?
 

M Bright

Hi Guys!

Just got it to work.

The above solution worked just fine.

The problem was elsewhere.

 

Almar Arnthorsson

Hi,

I am also trying to make a http request widget - remote.  For some reason nothing like that excists in the app store. 
Julia's WidgetSample/src works fine for what I'm after but for some reason the http request takes about 2 sec to execute my command.
Is there some way to fix that?  It's takes the same amount of time both on wifi and bluetooth. I'm runnig Tizen 5.5 (watch active 2)

I tried using HttpClient instead of HttpWebRequest and am able to get instant resaults there, but I am unable to set a proxy with HttpClient to use bluetooth.

Any advice would be appreciated.  And also if Dimitris would be willing to share his experiance or code, that would be fantastic.