Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

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

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 24, 2017 at 01:31 PM

    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

    Add comment
    10|10000 characters needed 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.