cancel
Showing results for 
Search instead for 
Did you mean: 

OS.getDevice() & OS.getOS(); not working on SAPUI5m

Former Member
0 Kudos

Hi,

I'm creating a responsive dashboard for both Desktop and iPad, but the functions called "Os.getDevice()" and "OS.getOS()" are not working properly. I did an "APPLICATION.createErrorMessage(device)" (being "device" a variable where the value of "OS.getDevice()" is saved), and it throws an empty message, both on PC and iPad.

How can I fix it?

Regards,

Gerard Riera Puig.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all,

I just solved it using this method:

if(device.indexOf("Windows") > 0|| device.indexOf("Macintosh") > 0) 
{
	//Code for Desktop devices
}
else
{
	//Code for mobile devices
}

I consider this post closed.

Best Regards,

Gerard Riera Puig.

Answers (1)

Answers (1)

jamie_cawley
Advisor
Advisor
0 Kudos

Maybe you want to be using the device api?

https://sapui5.hana.ondemand.com/1.34.7/docs/api/symbols/sap.ui.Device.html

Regards,

Jamie

Former Member
0 Kudos

Hi Jamie Cawley,

How can I use this api on Design Studio? Can you explain it to me a little bit, please?

Regards,

Gerard Riera Puig.