cancel
Showing results for 
Search instead for 
Did you mean: 

URLHelper does not work on mobile if it is binded into a function

merveguel
Participant
0 Kudos

Hi all,

Below code snipped does work and navigates to the generated link if the app is accessed over desktop browser, however it does not give any response if it is called from mobile phone browser (Iphone 14, Safari). Interestingly if the URLHelper control is called directly from the onpress function (see the dummy/hard-coded commented out line), then it works pretty fine. But it does not work if it is called in a binded function as below. I can not call the control in onpress since as you see I am making a callfunction to get the location parameters to generate the googlemaps link for every unique call. I am at this point out of options on what to do. I appreciate for any help.

onHandleDeviceLocationLinkPressed: function (oEvent, iEquipmentNumber) 

{ 

// If this dummy hard-coded url is called right here, then it works 

// URLHelper.redirect("https://www.google.com/maps/search/?api=1&query=49.2863488,8.6441984", true); 

let that = this; this._oSystem = this.getOwnerComponent().getModel(“system”); 

this._oSystem.callFunction("/getMachinePosition", 

{ 

method: 'GET', 

urlParameters: { Name: iEquipmentNumber, }, 

success: that._bindSystemCoordinatesSuccess, 

error: that._bindSystemCoordinatesFailed }); 

}, 

_bindSystemCoordinatesSuccess: function (obj) 

{ 

let oMachinePosition = obj.getMachinePosition; 

let sUrl = 'https://www.google.com/maps/search/?api=1&query='; 

// Does not response 

URLHelper.redirect(sUrl + oMachinePosition.latitude + "," + oMachinePosition.longitude, true); 

}, 

_bindSystemCoordinatesFailed: function (oText) 

{ 

MessageToast.show(“Error”); 

},

Accepted Solutions (0)

Answers (0)