Https requests are not executed on some devices only

Hi,experts, I am making a watchface that need activation.   A weird problem arised, the https request was not executed on some devices like fenix5xPlus and Tactix,but most devices like fr series worked fine. My code is like below. Sorry I cannot insert a code snippet,perhaps cuz of the risk control for a vpn access? 

I have made these efforts:

  1. check this thread,but I cannot confirm without explcit log. https://forums.garmin.com/developer/connect-iq/i/bug-reports/makewebrequest-bad-request-on-some-devices
  2. change my interface to https
  3. write a lot of logs in my server program. ie. if the web request is made, there would be at least a line of log.
  4. Let my user checked the GCM network connection and BLE connection between the mobile and his watch. He has no idea about side-loading and the most awkard thing is he doesnt own a pc , so I cannot collect any logs from side-loading debug on real devices with issues.

So can you give me any suggestions to find the culprit? THX, have a nice weekend

(:background)
class App extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
function onSettingsChanged() as Void {
InitBackgroundEvents();
setActivationTask();
WatchUi.requestUpdate();
}

function setActivationTask(){
Storage.setValue("needCheckActivation", true);
}
function InitBackgroundEvents(){
var FIVE_MINUTES = new Toybox.Time.Duration(5 * 60);
var lastTime = Background.getLastTemporalEventTime();
var nextTime;
if (lastTime != null) {
nextTime = lastTime.add(FIVE_MINUTES);
Background.registerForTemporalEvent(nextTime);
} else {
nextTime = Time.now();
Background.registerForTemporalEvent(nextTime);
}
}

function getServiceDelegate(){
return [new BackgroundServiceDelegate()];
}
function onBackgroundData(data) {
if (data != null){
doSomething();
}
}
}


import Toybox.Application;
import Toybox.Application.Storage;
import Toybox.Application.Properties;
import Toybox.Time;
import Toybox.Time.Gregorian;
import Toybox.Background;
import Toybox.System;
import Toybox.Communications;
// The Service Delegate is the main entry point for background processes
// our onTemporalEvent() method will get run each time our periodic event
// is triggered by the system.
(:background)
class BackgroundServiceDelegate extends System.ServiceDelegate {

function initialize() {
System.ServiceDelegate.initialize();
}

function onTemporalEvent() {
var needCheckActivation = Storage.getValue("needCheckActivation");
var activated = Storage.getValue("activated");
if(needCheckActivation){
System.println("activate will be performed");
activate();
}
}


function activate(){
var activationCode = Properties.getValue("ActivationCode");
var settings = System.getDeviceSettings();

if(settings != null && (activationCode == null || activationCode.equals("") || activationCode.length() == 32)){
System.println("http activation will be performed");
var options = {
:method => Communications.HTTP_REQUEST_METHOD_POST,
:headers => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON},
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
};
var code = sign(settings.uniqueIdentifier,activationCode,"appname");
Communications.makeWebRequest(
"">ip.com/.../activate",{
"code" => code
},
options,
method(:responseCallbackActivation)
);
}
}

function responseCallbackActivation(responseCode, data) {
if (responseCode == 200){
}else{
}
Background.exit(null);
}


function isValidActivationResult(result){

}

}

  • One thing I always do in background services that do comm is if It's not a 200 response, I return the responsCode, and then in onBackgroundData, have

    if(data instanceof Number) {

    //show error

    } else {

    //handle data

    }

    and 

    function responseCallbackActivation(responseCode, data) {
    if (responseCode == 200){

    Backround.exit(data);

    }else{

    Background.exit(responseCode);
    }

    }

    This way you can get an idea of what's happening without using log files, and just display the error in your app.