Languages

Menu
Sites
Language
My app only download data when is connected over wifi (not over phone/BT)

Hello, I'm developing a Simplenote port for Tizen, that allows me to read Simplenote notes on my Gear S2.

I'm using Simperium.js to download notes from Simplenote, and this library use sockJS.js to work.

The application works great, and can download notes from Simplenote database... but only when Gear is connected via wifi.

If I disconnect gear from wifi and use my phone data plan (or phone wifi) using BT connection, the program is unable to download data. I've got another app that download data using a simple XMLHttpRequest sentence, and that program works well.

Something like

var xmlhttp = new XMLHttpRequest(),

datos,

XML_ADDRESS = "http://*********",

XML_METHOD = "GET";

xmlhttp.open(XML_METHOD, XML_ADDRESS, false);

xmlhttp.onreadystatechange = function() {

if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {

datos = xmlhttp.responseText;

document.getElementById("tags").innerHTML = datos;

xmlhttp = null;

} else {

console.log("Error"); } };

xmlhttp.send();

But when I use this:

var api = new Simperium('chalk-bump-f49', {token : 'fffffff'});

var bucket = api.bucket('note');

localStorage.clear();

bucket.on('notify', function(id, object) {

BLABLABLA

Nothing works over BT. What I'm doing wrong? Any idea?

Thanks in advance.

Edited by: Pedro Exposito on 13 Mar, 2018

Responses

2 Replies
Armaan-Ul- Islam

When your Gear is Connected with Mobile via "Samsung Gear" (Gear Manager) App it has no direct aceess to internet . It is not your wearable who communicates with the internet, Rather it's the "Samsung Gear" app who receives your data (For ex: requests) via bluetooth and delivers data (For ex: response) back to you.

 

Gear has to communicate via the channel/bridge provided by "Samsung Gear" app. Only the features supported or provided by Gear Manager App would be available. I assume "Samsung Gear" app provides mechanism for simple XMLHttpRequest, That's why it's working fine.

 

Suggestions from my end:

i) Rather than using remote Code Src, Like:

<script type="text/javascript" src="https://XYZ.js"></script>

Store them on your Project Directory then import.

ii) Re-Check "download" & "internet" privileges in your config.xml file.

iii) If still the Issue remains, May be for your app you have to Offer Wi-fi / Cellular  Sync only.

Pedro Exposito

Thanks for your answer. The library is stored inside my working folder, so that's not the problem. And the privileges are doble checked. It seems something about websockets. Anyway, my program works now. I've remove the JS library and now I'm using xhtml calls. It's a little more slow but now works over every network.

 

Thanks anyway.