How to determine where is the app is running


Paolo Lops
Hi David,there is a way to make a conditional #if debug to set some variables only if in AP ide and not in production server?regards Paolo

DecSoft

Hello Paolo,

Please, upgrade your AB copy. Among other changes, you can see two new app's global variables: [App.Url] and [App.Debugger]. The second one store "true" if the app is running in the App Builder debugger and "false" if not. However, note that if we launch the app in another browser, for example, Firefox (which is recomendable, because the App Builder debugger console is not so good than the Firefox one, for example), the [App.Debugger] variable stores "false".

The first new variable [App.Url] may can be useful too for your purposes, since this variable stores the URL of the app, for example, "http://127.0.0.1:9999/#!/View1", so, with the help of some actions we can determine if the app is running in an "local URL" or not, for example:

We can place the above code at the start of the app (for example, in the main view Show event) and prepare an variable instead to shown a message, that is:

Then we can use the [AppIsRunningInLocal] variable when needed.



DecSoft

Hello again,

I forgot to say that the [App.Cordova] global app's variable. This variable store "true" if the app is running in an Apache Cordova WebView, in other words, if the app has been compiled using Apache Cordova and run in Android, iOS, etc. The variable store "false" if the app has not been compiled with Apache Cordova, in other words, run in an browser or as an browser's Web Extension.


Paolo Lops

Good job David!!!

it is what i was looking for!



DecSoft

Thanks Paolo!


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.