Current Android Release version:
Version Code: Pie
Version: 9
API level: 28

Sencha Touch API

The environment package in Sencha Touch gives you an API which tells about the environment your application is running on.

Operating System:
We can detect the operating system your application is running on using Ext.os.name.It retruns the following values:
  • Android
  • iOS
  • Blackberry
  • Other
You can also use the Ext.os.is singleton to check if the current OS matches a certain operating system.

if (Ext.os.is.Android) 

      // ... 
if (Ext.os.is.MacOS) 
     // ... 
}

We can also detect if the device is an iPhone or iPad using Ext.os.is

if (Ext.os.is.iPad) 
{
   // ... 
}

we can also detect version of the operation system your application is running on using Ext.os.version

Browser:
We can find information about the browser you are running your application on by using Ext.browser.name

It returns the following values:

  • Safari
  • Chrome
  • Opera
  • IE
  • Other
You can also use Ext.browser.is to check the current browser.

if (Ext.browser.is.Chrome) 

     // ... 
}

Features:
You can use the Ext.feature singleton to check if a certain browser feature exists.

For example, if you want to check if the browser supports canvas, you check use the following code:

if (Ext.feature.has.Canvas) 
{
     // ... 
}

No comments:

Post a Comment