Skip to Content
0

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

Oct 24, 2017 at 01:26 PM

20

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Oct 24, 2017 at 01:53 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Jamie Cawley
Oct 24, 2017 at 01:31 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

0