One of the used frameworks integrated with DecSoft App Builder is Capacitor. This framework is well integrated in DecSoft App Builder in various ways for your convenience. Continue reading this help topic to see how Capacitor is integrated in DecSoft App Builder.
DecSoft App Builder creates the right Capacitor configuration file for your app, based in Capacitor related options that you can set. One of these options are the Extra XML one, which allows to add optional stuff to the Capacitor configuration file.
When you check the "Create a Capacitor config file" from the Capacitor General app options, the next time that the app is compiled, DecSoft App Builder creates several icons (based in the app icon that you can set in the app Interface options) for all the supported platforms. These icons are well referred then in the Capacitor configuration file, in order to be used by the platforms in which our app was running.
You can additionally set "adaptative icons" for the Android platform. DecSoft App Builder take these icons (if provided) also to generate the appropriate adaptative icons.
When you check the "Create a Capacitor config file" from the Capacitor General app options, the next time that the app is compiled, DecSoft App Builder creates several splash screens (based in the app splash screen that you can set in the app Capacitor Splashs options) for all the supported platforms. These splash screens are well referred then in the Capacitor configuration file, in order to be used by the platforms in which our app was running.
When you check the "Create a Capacitor config file" from the Capacitor General app options, and then check one or more of the Batch & Shell platforms, the next time that the app is compiled, DecSoft App Builder creates the right batch files for Microsoft Windows.
DecSoft App Builder creates various batch files per platform. Take a look at the below tables, which refers the batch files to be executed in Microsoft Windows:
| Batch file | Description |
|---|---|
| capacitor_android.bat | Execute this file to get an APK file or AAB file of the app. |
| capacitor_android_run.bat | Connect an Android device to your computer and then execute this file in order to get a debug APK of the app launched in your device to be debugged. This is probably the best way to try the apps in the Android platform. If no connected devices are found, the configured emulator is used instead. |
| Batch file | Description |
|---|---|
| capacitor_ios.bat | Execute this file to get an XCode project files to be opened and compiled using an Apple Mac OS computer. Unfortunately it's not possible to create IPA files of the app from Microsoft Windows, so this file creates the right XCode project files only. |
When you check the "Create a Capacitor config file" from the Capacitor General app options, and then check one or more of the Batch & Shell platforms, the next time that the app is compiled, DecSoft App Builder creates the right shell files for Apple Mac OS.
DecSoft App Builder creates various shell files per platform. Take a look at the below tables, which refers the shell files to be executed in Apple Mac OS:
| Shell file | Description |
|---|---|
| capacitor_ios.sh | Execute this shell file from your Apple Mac OS computer to get an XCode project files ready to be opened, compiled and debugged in some device or emulator. |
There are hundreds of useful Capacitor plugins ready to be used in your app when needed. Every Capacitor plugin exposes a JavaScript API in form of JavaScript objects and methods ready to be called. We can use these plugins to get information about the user device, to capture audio and video and many more things.
DecSoft App Builder integrates "out of the box" some of the official Capacitor plugins. You can use these plugins just by checking them in the app options. Doing that the selected plugins are included in the generated Batch files and Shell files, in order to be installed for your app.
Below you can see refer all the "out of the box" Capacitor plugins integrated in DecSoft App Builder, as well the JavaScript API that these plugins provides to you.
The Capacitor Device plugin provides to you information about the device in which your app is running. This plugin put available the below JavaScript methods to retrieve the device information.
Return an unique identifier for the device. This method returns a promise with an object with the device identifier information.
| Property | Type | Description |
|---|---|---|
| identifier | String | The identifier of the device as available to the app. This identifier may change on modern mobile platforms that only allow per-app install ids. On iOS, the identifier is a UUID that uniquely identifies a device to the app's vendor. On Android 8+, the identifier is a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user and device. |
Return information about the underlying device/os/platform. This method returns a promise with an object with the device information. Below you can see a table with these object properties and their description.
| Property | Type | Description |
|---|---|---|
| model | String | The name of the device. For example, "John's iPhone". This is only supported on iOS and Android 7.1 or above. On iOS 16+ this will return a generic device name without the appropriate entitlements. |
| model | String | The device model. For example, "iPhone13,4". |
| platform | String | The device platform (lowercase). Can be: "ios" or "android". |
| operatingSystem | String | The operating system of the device. Can be: "ios" or "android". |
| osVersion | String | The version of the device OS. |
| iOSVersion | Number | The iOS version number. Only available on iOS. Multi-part version numbers are crushed down into an integer padded to two-digits, ex: "16.3.1" -> 160301 |
| androidSDKVersion | Number | The Android SDK version number. Only available on Android. |
| manufacturer | String | The manufacturer of the device. |
| isVirtual | Boolean | Whether the app is running in a simulator/emulator. |
| memUsed | Number | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used. |
| webViewVersion | String | The web view browser version. |
Return information about the battery. This method returns a promise with an object with the battery information. Below you can see a table with these object properties and their description.
| Property | Type | Description |
|---|---|---|
| batteryLevel | Number | A percentage (0 to 1) indicating how much the battery is charged. |
| isCharging | Boolean | Whether the device is charging. |
Get the device's current language locale code. This method returns a promise with an object with the device language code information. Below you can see a table with these object properties and their description.
| Property | Type | Description |
|---|---|---|
| value | String | Two character language code. |
Get a well-formed IETF BCP 47 language tag. This method returns a promise with an object with the device language tag information. Below you can see a table with these object properties and their description.
| Property | Type | Description |
|---|---|---|
| value | String | Returns a well-formed IETF BCP 47 language tag. |
You can use the Capacitor Dialogs plugin in order to show to the user customizable natives dialogs. Note that all the methods provided by this Capacitor plugin fallback in the native "alert", "confirm" and "prompt" JavaScript functions, so this plugin can be used also in non Capacitor platforms. This is a very easy to use and useful plugin that offers to you the below methods ready to be used:
Show an alert dialog to the user. Below you can see a table with the method parameters and their description.
| Name | Type | Description |
|---|---|---|
| title | String | Title of the dialog. |
| message | String | Message to be shown in the dialog. |
| buttonTitle | String | Title of the dialog button. |
Show a prompt dialog to the user. Below you can see a table with the method parameters and their description.
| Name | Type | Description |
|---|---|---|
| title | String | Title of the dialog. |
| message | String | Message to be shown in the dialog. |
| okButtonTitle | String | Text to use on the positive action button. |
| cancelButtonTitle | String | Text to use on the negative action button. |
| inputPlaceholder | String | Placeholder text for the input field. |
| inputText | String | Initial text for the input field. |
If everything is right, this method returns a Promise with an object with the following properties.
| Name | Type | Description |
|---|---|---|
| cancelled | Boolean | Indicates if the dialog was cancelled. |
| value | String | The value entered by the user. |
Show a confirm dialog to the user. Below you can see a table with the method parameters and their description.
| Name | Type | Description |
|---|---|---|
| title | String | Title of the dialog. |
| message | String | Message to be shown in the dialog. |
| okButtonTitle | String | Text to use on the positive action button. |
| cancelButtonTitle | String | Text to use on the negative action button. |
If everything is right, this method returns a Promise with an object with the following properties.
| Name | Type | Description |
|---|---|---|
| value | Boolean | Indicates if the user confirmed the dialog. |
The Capacitor SystemBars plugin allows to control the system bars on Android and iOS devices, such as the status bar and navigation bar. It provides methods to show, hide, and customize the appearance of these bars to enhance the user experience in your app. Below you can see refer the methods of this plugin.
This is an object variable that stores all the possible values to be used with the app.capacitor.systemBars.setStatusBarStyle() and app.capacitor.systemBars.setNavigationBarStyle() methods. This object variable provide the below properties / values to be used:
| Name | Type | Description |
|---|---|---|
| dark | String | Light system bar content on a dark background. |
| light | String | For dark system bar content on a light background. |
| default | String | The style is based on the device appearance or the underlying content. If the device is using Dark mode, the system bars content will be light. If the device is using Light mode, the system bars content will be dark. |
Use this method to hide the system status bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while hiding the status bar.
Use this method to show the system status bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while showing the status bar.
Use this method to set the style of the system status bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while setting the status bar style.
Use this method to hide the system navigation bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while hiding the navigation bar.
Use this method to show the system navigation bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while showing the navigation bar.
Use this method to set the style of the system navigation bar. This method returns a Promise that you can use to assert that the operation was successful or to handle any errors that may occur while setting the navigation bar style.
The Capacitor InAppBrowser plugin allows, for example, to open a URL in the device's system browser. Take a look at the below methods of this plugin.
Unfortunately, this plugin requires a bit of work from you to properly works. Capacitor do not provide a way to establish the MIN SDK version for the Android platform, better said, provides a way, but, by editing some file manually.
This plugin requires a MIN SDK version 26 in order to properly works, so, if you see an error related with this when compile the app with Capacitor, open the "\compiled\capacitor\android\variables.gradle" in a text editor and set "minSdkVersion = 26".
After that, you can compile the app again with Capacitor (by executing, for example, the "capacitor_android.bat" provided by DecSoft App Builder), this time without the related error.
Open the provided URL in the device's system browser. This method fallback to the JavaScript window.open() method if the app is not running in a Cordova platform. This method returns a Promise but only the "catch" will be executed if an error occur while opening the URL. Below you can see a table with the method parameters and their description.
| Name | Type | Description |
|---|---|---|
| url | String | The URL to open in the system browser. |
The Capacitor Screen Orientation plugin provides to you a way to change and lock the device screen orientation at runtime. By default the screen orientation is unlocked - all orientations are supported: you must use (and probably wanted) to establish an orientation (the same that you use when design your app in DecSoft App Builder) at run time. This plugin put also available the app OrientationChange event.
This is an object variable that stores all the possible values to be used with the app.capacitor.screenOrientation.lock() method. This object variable provide the below properties / values to be used:
| Name | Type | Description |
|---|---|---|
| portraitPrimary | String | The orientation is in the primary portrait mode. |
| portraitSecondary | String | The orientation is in the secondary portrait mode. |
| landscapePrimary | String | The orientation is in the primary landscape mode. |
| landscapeSecondary | String | The orientation is in the secondary landscape mode. |
| portrait | String | The orientation is either portrait-primary or portrait-secondary (sensor). |
| landscape | String | The orientation is either landscape-primary or landscape-secondary (sensor). |
| any | String | The screen orientation is unlocked - all orientations are supported. |
You can use this plugin method to lock the screen orientation to one of the "app.capacitor.screenOrientation.orientation.*" values. This method admits the below argumens:
| Name | Type | Description |
|---|---|---|
| orientation | String | One of the "app.capacitor.screenOrientation.orientation.*" values. |
You can use this plugin method to unlock the screen orientation.
You can use this plugin method to know the current established screen orientation. This method returns one of the "app.capacitor.screenOrientation.orientation.*" values.