I'm developing my first mobile app using the Telerik platform and I'm trying to find a way of dynamically setting the configuration based on the environment that the code is running in. e.g.:
var apiUrl;
function setConfig()
{
if (window.navigator.simulator)
{
// Debug in simulator
apiUrl = "http://localhost:1234/api/myapp";
}
else if ( ??? )
{
// System Testing
apiUrl = "https://beta.myapp.com/api/myapp";
}
else {
// Production
apiUrl = "https://myapp.com/api/myapp";
}
}
What I'd like to be able to do is tell if the application is running within Telerik's AppBuilder mobile app, which I'm using for system testing, or as a packaged application (production app)
I've had a trawl through Telerik's javascript API, but can't see anything that seems to fit the bill, and I don't expect to find anything in the Cordova API since this is specific to the Telerik platform.
Any ideas?
You can accomplish this with debug and release-specific files inside of AppBuilder (see the docs). This allows you to target debug files for your debug (i.e. test) builds and release files for your release (i.e. app store) builds.