Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Create Developer App Related Logic

During development, you can detect if your app is running in the Cordova developer app and create logic to work around some of its limitations. For example, when your code is loaded in the developer app, you might show or log warnings when you try to call methods of unsupported plugins or you can point your app to consume resources from an alternative location.

Developer App JavaScript API

AppBuilder provides the boolean isInCompanionApp global variable. This property has the following values.

  • true: Indicates that the app is running in the developer app.
  • false: Indicates that the app is not running in the developer app.

Developer App JavaScript API Examples

/* 
* Detects if the app is running in the developer app.
* If running in the Developer App, shows a simple warning alert.
* When the alert is dismissed, executes the logic defined in dismissAlert.
*/

if (typeof(isInCompanionApp) === true) {
    navigator.notification.alert("Your app is running in the developer app. Test results might be inaccurate.", dismissAlert, "Developer App Alert", "OK");  
};
/*
* Sets a configuration based on whether the app is running in the developer app.
*/

function setConfig() {
  if (typeof(isInCompanionApp) === true) {
     apiUrl = "http://localhost:1234/api/myapp";
     }
  else {
     apiUrl = "https://myapp.com/api/myapp";
    }
};

Best Practice

You might want to check if your app is running in the developer app in your onDeviceReady callback and implement your developer app related logic there. This way, as soon as Apache Cordova has fully loaded and right before executing any other code, you can apply your developer app related logic. For example, you can make configuration changes which affect the behavior and performance of your app.

Next Steps

Run Your App in the Cordova developer app.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.