1. #1
    Sencha User
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    -1
    lenoil is an unknown quantity at this point

      0  

    Default file config and android

    file config and android


    Hi,

    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 ....

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    74
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    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.

  3. #3
    Sencha User
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    -1
    lenoil is an unknown quantity at this point

      0  

    Default


    so then it is probably best to install the files without javascript compilation and run it from the navigator of the tablet. if the "person responsible" wants to change settings on the shelves of these users it goes into the configuration file ....

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    74
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    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.

  5. #5
    Sencha User
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    -1
    lenoil is an unknown quantity at this point

      0  

    Default


    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 ?

  6. #6
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    74
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    Yep...

    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.

  7. #7
    Sencha User
    Join Date
    Oct 2007
    Posts
    81
    Vote Rating
    -1
    lenoil is an unknown quantity at this point

      0  

    Default


    ok I'll see how I can meet my needs with your information

    thank you again

Thread Participants: 1