GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
04/24/12 12:28 AM (12 years ago)

Five Minute Tutorial : Configuration Data File

Hi! Based on a suggestion by @ASusoeff, I'm going to attempt to do a few brief tutorials in the forum. I'm calling them "Five Minute Tutorials" because I hope it takes no longer than that for you to read it get the jist of what's being discussed. First topic : Configuration Data File The Configuration Data File is what drives all the content of your app. If you look in your download package, you will find the configuration files in the following locations: v1.4 * iOS : config/config.txt * Android : res/raw/config.txt v1.5 * iOS : BT_Config/BT_Config.txt * Android : assets/BT_Config.txt v2.0 * iOS : BT_Config/BT_Config.txt * Android : assets/BT_Config.txt Crack open those files, and you will see all the JSON that drives the look, feel, and content of your app. I'll explain JSON in another tutorial, but in simplest terms, it's the DNA that guides the creation of the screens and features you define for your app. Each screen you make, all the properties of those screens, and how they are linked together, is saved in this file. Note : The v1.4 config file just points to a URL on the buzztouch server. All the config data is then pulled from there...it is not contained in the BT_Config.txt file like in v1.5 and v2.0. This is the reason v1.4 apps always require a network connection, and cannot be taken offline. When a user runs your app, some amazing magic handcrafted by @David of buzztouch takes the JSON information, feeds it through various Java (Android) or Objective C (iOS) files, which are used to create the actual screens that you see on your device. It's truly quite amazing if you think about it. Before buzztouch, you would have had to write the code that David has done for you, in addition to all the little details about the individual screens. David has abstracted that for you, written an interface between simple JSON and more complex Java/Objective C, and allows you to create super complex apps with not so complex JSON. Pretty amazing! So, we now know that the Configuration Data File is the guts of the app. Any changes you make to your app in the control panel, they get recorded in the config file for you app at buzztouch.com, or on your own BT server. When a user opens the app, it checks what's called the Report to Cloud URL for any updates. If it sees any, it downloads the new config file, and uses that to build the app. If there are no changes, or it can't reach the new config file, it uses a cached version. Pretty simple. The other amazing thing is that your configuration file can be (1) hosted at buzztouch.com by default, (2) hosted at a remote location like DropBox or a web server, or (3) can be included as part of an offline app (if you don't want to rely on a network connection to get the config data). Even further in coolness is that your config file can contain pointers to other JSON files, which are then merged into the larger config file! For example, you could create a Multiple Location Screen in your control panel, but point to a config file in DropBox that has the location data in it. When the main config file process the information, it'll go out to DropBox, grab the file, merge it into the main file, and create your app. It should be obvious, but you can use this method to update just parts of your app without having to update the whole thing! You could also, in theory, create every portion of your app with a hand-crafted JSON file, assuming you follow the format for the various screens. Speaking of which, here is the v1.5 documentation, and it tells you all the required JSON fields and formats for the different screens: http://www.buzztouch.com/docs/v1.5 So, I'm not sure if I've blown my 5 minutes or not, but that's it in a nutshell. Surely there are more complex parts of this, but if you understand the basics, you'll have a better appreciation for how your app works. The Configuration Data File is basically the ONLY part of your app that changes when you add/remove/modify screens, so you should only have to download your source package once. If you need to grab the latest configuration data, just go into the control panel for your app, select "Show App's Configuration Data," and that will give you the current Data Configuration File for your app. You can then copy/paste into your local BT_Config.txt file to sync your local copy with the server copy. This is good if you are having trouble seeing updates to your app. I hope this helps a bit! I'm sure I've forgotten a few things, so please don't hesitate to ask any questions, or ask for clarification! Thanks, Mark [Edit] If you are going to host your own Data Configuration File somewhere, you just need to create a text file with properly formatted JSON in it, and point your app to it. If you look in your default configuration file, you'll notice the Configuration Data URL looks something like this: http://www.buzztouch.com/api/app/?command=getAppData&appGuid=JAB8... However, you can make it look something like this, and it'll still work: http://www.yourserver.com/apps/myConfigFile.txt As long as the JSON is valid (which you can check at JSONlint.com), then all will be well. In the URL you see in your default config file, all that extra stuff just tells the server what app to get the config data for. Since buzztouch.com stores all your information in databases, it's just a query of the DB to get your personal info. Not necessary when you host the file yourself.
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
04/24/12 12:45 AM (12 years ago)
Great writing! I think it's a good basic description especially for new users to wrap their heads around...you could go off into the topic of the Config.txt file on initial download for first time app viewers? But it might be more confusing...awesome work as always :)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
04/24/12 12:49 AM (12 years ago)
Thanks, Ian...that's a great suggestion. I'll figure out the best way to add it. Mark
 
UniApps
Aspiring developer
Profile
Posts: 124
Reg: Apr 21, 2012
An American in ...
5,940
like
04/24/12 02:26 AM (12 years ago)
But, to host the data on my own web server, what is the new format of this statement: http://www.buzztouch.com/api/app/?command=getAppData&appGuid=JAB8... http://mydomain.com/myMapApp.txt ? Is the file to be named .txt or .html or .js or does it matter? Since it is just plain text as js code? Also, if I host my own data file, in order to keep the Map points fresh, what happens here: reportToCloudURL":"http://www.buzztouch.com/api/app/?command=reportToCloud&appGuid=JAB8... Just leave it be, because the App itself won't change? Unless I add features other than Map points? So I use PHP to write the new "BT_config.txt" file, name it and upload it to my web server, refresh (rebuild), and IOS Simulator will find the changes? Right now, IOS Simulator s saying I need to change Default.png, but I did that, and every instance of Default.png in Xcode is my custom png.
 
UniApps
Aspiring developer
Profile
Posts: 124
Reg: Apr 21, 2012
An American in ...
5,940
like
04/24/12 02:58 AM (12 years ago)
OK, I did all of that, and it worked. What I did, as a before-lunch watershed moment, was change the color of the screens from white FFFFFF to a softer pastel. It worked. It still says to change Default.png, and I don't know how many more places to look to do that.
 
Tony @ Buzztouch
buzztouch Evangelist
Profile
Posts: 528
Reg: Mar 05, 2011
Saint Louis, Mi...
24,620
like
04/24/12 03:19 AM (12 years ago)
Mark! Great work my friend. Can't wait to read your next lesson. Stay safe out there Tony
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
04/24/12 05:24 AM (12 years ago)
As always, good work buddy.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
04/24/12 09:40 AM (12 years ago)
Hi @nickbear, Looks like you figure it out all! I've made an edit above to the tutorial to describe what you are talking about with respect to the Data Configuration URL. As far as Default.png goes, the only place I know to change that is the actual file which is in the root folder of the iOS download package. I always use Default*.png as my splash screen instead of the buzztouch screen for that. Works perfectly! Mark
 
aquila198
buzztouch Evangelist
Profile
Posts: 473
Reg: Jul 22, 2011
location unknow...
10,330
like
04/24/12 10:16 AM (12 years ago)
Excellent overview!
 
guisante
Aspiring developer
Profile
Posts: 290
Reg: May 14, 2011
Spain
14,500
like
04/24/12 12:52 PM (12 years ago)
Thanks to share your tutorial!
 
Crown Solutions
Aspiring developer
Profile
Posts: 463
Reg: Nov 11, 2011
MN
13,480
like
04/24/12 02:53 PM (12 years ago)
Looks good, easy to understand. Thanks!
 
Scoobing
Lost but trying
Profile
Posts: 19
Reg: Jun 18, 2013
Manchester, UK
6,590
like
06/27/13 01:24 AM (10 years ago)
Thank you for this tutorial. I have been wondering how the BT changes get to my local Xcode without the config file in Xcode changing. Clears up so much. Thanks again. Barry in Manchester, UK Mac, 3.2Gz, Intel Core i5, 8GB Ram, OS X 10.8.4 Xcode Version 4.6.3 (4H1503), iOS Apps.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.