Class sap.m.AppModule: sap/m/App
App is the root element of a UI5 mobile application. It inherits from NavContainer and thus provides its navigation capabilities. It also adds certain header tags to the HTML page which are considered useful for mobile apps.
sClassName
and enriches it with the information contained in oClassInfo
.fnFunction
to the orientationChange
event of this sap.m.App
.fnFunction
from the orientationChange
event of this sap.m.App
. Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- homeIcon : any
- backgroundColor : string
- backgroundImage : sap.ui.core.URI
- backgroundRepeat : boolean (default: false)
- backgroundOpacity : float (default: 1)
- Events
- orientationChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.m.NavContainer can be used as well.
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{boolean} | oControlEvent.getParameters.landscape | Whether the device is in landscape orientation. |
- Deprecated:
- Since version 1.20.0. use sap.ui.Device.orientation.attachHandler(...)
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.m.NavContainer.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
backgroundColor
. Background color of the App. If set, this color will override the default background defined by the theme. So this should only be set when really required. Any configured background image will be placed above this colored background. But any theme adaptation in the Theme Designer will override this setting. Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
- Since:
- 1.11.2
{string} | Value of property backgroundColor |
backgroundImage
. Background image of the App. If set, this image will override the default background defined by the theme. So this should only be set when really required. This background image will be placed above any color set for the background. But any theme adaptation in the Theme Designer will override this image setting. Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
- Since:
- 1.11.2
{sap.ui.core.URI} | Value of property backgroundImage |
backgroundOpacity
. Opacity of the background image. The opacity can be set between 0 (fully transparent) and 1 fully opaque). This can be used to make the application content better readable by making the background image partly transparent.
Default value is 1
.
- Since:
- 1.11.2
{float} | Value of property backgroundOpacity |
backgroundRepeat
. Whether the background image (if configured) should be proportionally stretched to cover the whole App (false) or whether it should be tiled (true).
Default value is false
.
- Since:
- 1.11.2
{boolean} | Value of property backgroundRepeat |
homeIcon
. The icon to be displayed on the home screen of iOS devices after the user does "add to home screen".
Note that only the first attempt to set the homeIcon will be executed, subsequent settings are ignored.
This icon must be in PNG format. The property can either hold the URL of one single icon which is used for all devices (and possibly scaled, which looks not perfect), or an object holding icon URLs for the different required sizes.
A desktop icon (used for bookmarks and overriding the favicon) can also be configured. This requires an object to be given and the "icon" property of this object then defines the desktop bookmark icon. For this icon, PNG is not supported by Internet Explorer. The ICO format is supported by all browsers. ICO is also preferred for this desktop icon setting because the file can contain different images for different resolutions.
One example is:
app.setHomeIcon({ 'phone':'phone-icon.png', 'phone@2':'phone-retina.png', 'tablet':'tablet-icon.png', 'tablet@2':'tablet-retina.png', 'icon':'desktop.ico' });
The respective image sizes are 57/114 px for the phone and 72/144 px for the tablet. If an object is given but one of the sizes is not given, the largest given icon will be used for this size.
On Android these icons may or may not be used by the device. Apparently chances can be improved by adding glare effect and rounded corners, setting the file name so it ends with "-precomposed.png" and setting the "homeIconPrecomposed" property to "true".
{any} | Value of property homeIcon |
backgroundColor
. Background color of the App. If set, this color will override the default background defined by the theme. So this should only be set when really required. Any configured background image will be placed above this colored background. But any theme adaptation in the Theme Designer will override this setting. Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
When called with a value of null
or undefined
, the default value of the property will be restored.
{string} | sBackgroundColor | New value for property backgroundColor |
- Since:
- 1.11.2
{sap.m.App} | Reference to this in order to allow method chaining |
backgroundImage
. Background image of the App. If set, this image will override the default background defined by the theme. So this should only be set when really required. This background image will be placed above any color set for the background. But any theme adaptation in the Theme Designer will override this image setting. Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.URI} | sBackgroundImage | New value for property backgroundImage |
- Since:
- 1.11.2
{sap.m.App} | Reference to this in order to allow method chaining |
backgroundOpacity
. Opacity of the background image. The opacity can be set between 0 (fully transparent) and 1 fully opaque). This can be used to make the application content better readable by making the background image partly transparent.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is 1
.
{float} | fBackgroundOpacity | New value for property backgroundOpacity |
- Since:
- 1.11.2
{sap.m.App} | Reference to this in order to allow method chaining |
backgroundRepeat
. Whether the background image (if configured) should be proportionally stretched to cover the whole App (false) or whether it should be tiled (true).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bBackgroundRepeat | New value for property backgroundRepeat |
- Since:
- 1.11.2
{sap.m.App} | Reference to this in order to allow method chaining |
homeIcon
. The icon to be displayed on the home screen of iOS devices after the user does "add to home screen".
Note that only the first attempt to set the homeIcon will be executed, subsequent settings are ignored.
This icon must be in PNG format. The property can either hold the URL of one single icon which is used for all devices (and possibly scaled, which looks not perfect), or an object holding icon URLs for the different required sizes.
A desktop icon (used for bookmarks and overriding the favicon) can also be configured. This requires an object to be given and the "icon" property of this object then defines the desktop bookmark icon. For this icon, PNG is not supported by Internet Explorer. The ICO format is supported by all browsers. ICO is also preferred for this desktop icon setting because the file can contain different images for different resolutions.
One example is:
app.setHomeIcon({ 'phone':'phone-icon.png', 'phone@2':'phone-retina.png', 'tablet':'tablet-icon.png', 'tablet@2':'tablet-retina.png', 'icon':'desktop.ico' });
The respective image sizes are 57/114 px for the phone and 72/144 px for the tablet. If an object is given but one of the sizes is not given, the largest given icon will be used for this size.
On Android these icons may or may not be used by the device. Apparently chances can be improved by adding glare effect and rounded corners, setting the file name so it ends with "-precomposed.png" and setting the "homeIconPrecomposed" property to "true".
When called with a value of null
or undefined
, the default value of the property will be restored.
{any} | oHomeIcon | New value for property homeIcon |
{sap.m.App} | Reference to this in order to allow method chaining |
fnFunction
to the orientationChange
event of this sap.m.App
. When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.App
itself.
Fired when the orientation (portrait/landscape) of the device is changed.
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.m.App itself |
- Deprecated:
- Since version 1.20.0. use sap.ui.Device.orientation.attachHandler(...)
{sap.m.App} | Reference to this in order to allow method chaining |
fnFunction
from the orientationChange
event of this sap.m.App
. The passed function and listener object must match the ones used for event registration.
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
- Deprecated:
- Since version 1.20.0. use sap.ui.Device.orientation.attachHandler(...)
{sap.m.App} | Reference to this in order to allow method chaining |
orientationChange
to attached listeners. Expects the following event parameters:
landscape
of typeboolean
Whether the device is in landscape orientation.
{Map} | mArguments? | The arguments to pass along with the event |
- Deprecated:
- Since version 1.20.0. use sap.ui.Device.orientation.attachHandler(...)
{sap.m.App} | Reference to this in order to allow method chaining |