23 Jan 2013 2:06 AM #1
file config and android
file config and android
I have compiled my application for android it works .
But I have a file js configuration under app/config/Constants.js for my application.
Is it possible to have this file and these parameters in android application ? or in options when I install file apk ?
Thanks for your response ....
23 Jan 2013 2:14 AM #2
What you need to do is make sure that the file is required using Ext.require. In the past I've done this right at the top of my app.js file, not sure if this is best practice.
The issue is, that if you don't do Ext.require, an app may still survive during testing - because when it comes across a reference to this config class, it will load in the file during runtime with Ext.loader.
However, the production builder doesn't have the luxury of being able to load files in at runtime, as of course it's building one single minified file up front. So the Ext.require('Class name'); line tells the build script to also include this class definition in the single minified file.
Hope this helps.
23 Jan 2013 3:31 AM #3
23 Jan 2013 3:37 AM #4
Not sure I understand... do you want the end user to be able to modify these constants? If so you should look at setting them up as a record in the localstorage or something similar.
You should always combine and minify your code into one file unless you absolutely have to do it differently. The load times and offline storage advantages are too big to ignore.
23 Jan 2013 5:27 AM #5
in fact it is an application with constants that the administrator will be able to change (I work with
openlayers.org , vectors layers can change the outline color, etc .....), the administrator must go in this file and then edit these constants, redeploy application that uses these variables.
The Users can not configure it.
are you understand ?
23 Jan 2013 5:38 AM #6
So I still wouldn't like having the Constants class dynamically loaded at runtime. I've tried similar arrangements and the reason I don't like it is because I want my app executing as similarly as possible between my testing, development and production environments.
I would setup the Constants as a model, and also give them a store, that loads them in from a JSON file. Your admins can then edit the JSON file, and you can still get Sencha Cmd to build all of the code of the app into a single minified file.
One gotcha here is you need to make sure, as with all other local JSON stores, to require the JSON file in the app.json file.
23 Jan 2013 6:05 AM #7
ok I'll see how I can meet my needs with your information
thank you again