Discussion Forums  >  Uncategorized

Replies: 13    Views: 159

steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
11/28/11 03:30 AM (12 years ago)

BT Server 212 not creating JSON formatted configuration file

Have been having issues getting Android apps to download the configuration data and believe the above is the problem Please see an earlier post of the symptons and troubleshooting that draws me to this conclusion: http://www.buzztouch.com/forum/thread.php?tid=EB8DEDAB085FDE77AB2F0AA Any thoughts, advice, help would be appreciated :)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/28/11 10:45 AM (12 years ago)
I'll post to the other discussion too, a few things happening here. For this issue, do this... a) Click the Configuration Data link for the app in the control panel. This will show the current config data. Copy / paste this to text file if want for reference b) Download the projects source. The BT_config.txt file should match the JSON you saw / copied in a) exactly. If this is not the case, something for sure is funky. Another way to do it. Copy the dataURL value from the config data and paste it in your browser, it should produce the exact same data.
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 10:52 AM (12 years ago)
Thanks for the response David, hope you a good long weekend off Am unable to do option A or B as the JSON config data doesn't load (think I said that in the other post). Apologies for double post on the same ttopic
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 10:55 AM (12 years ago)
Will try copy n paste URL to see what it give, but don't think that will solve the non or incorrect JSON formatted config file issue
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 10:58 AM (12 years ago)
Q? Where SHOULD the JSON formatted config file be output to? Can look & see if Sever has actually created any kind of file
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 11:11 AM (12 years ago)
Posted from previous post: 1. The packaged code downloads and compiles fine in Eclipse 2. The BT_congig.txt file data appears to be correct 3. The JSON formatted config file doesn't seem to be generated or is incorrect according to LogCat output 4. The above appears to be true as no JSON data is loaded when selecting 'Config Data' in Control Panel Hope that clarifies.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/28/11 11:12 AM (12 years ago)
Yup..makes perfect sense. A few ideas to get your head around. a) When you click the Config Data link to show the data in the control panel, the web-app fetches data from a URL then shows it in the textarea. The URL it fetches data from is the exact URL that the app uses for dataURL and it's the same URL that package manager uses when it packages up the code for a project. So, it's this dataURL that's not working. b) The JSON data is not 'output' anywhere permanently. When you package a project a text file is created in the project, when you look at the Config Data it's just grabbing the text and putting it in the textarea. The JSON data is a result of all sorts of database queries and other options to create it on-the-fly with each request. This means all you'll need to do is to figure out why your install won't output the JSON. The best way to do this will be to grab the URL for the output. 1) Load up the config data screen (it will be blank because it's not working) 2) View Source. Scroll down a few lines and look at the BODY tag in the HTML. A URL will be in that this tag. This is the URL that will (should) produce the JSON. Because it won't, we'll need to figure out why. Start there...see what you get. The isse will be somewhere in the BT-server/api/app/index.php file I suspect.
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 11:17 AM (12 years ago)
Thanks for the quick response David Makes sense for the JSON data to be created on the fly. Will keep you posted on what it turns up BTW - Let me know when you need a hand moving everything over to new forum Steve
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/28/11 11:36 AM (12 years ago)
Forum move. For sure! You're on the short-list of folks we intend on asking to help categorize stuff when the new forum is up. Each question will need to be added to the appropriate forum by way of a drop-down or link or whatever. Shouldn't take the core-gang (you're in this group) long to get things organized. As it stands now, all the forums posts are 'uncategorized' so moving them shouldn't be too tough. Cool. Back later.
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/28/11 01:10 PM (12 years ago)
Initial results: URL from body tag in HTML of View JSON Data: <body onload=startConfigDownload('http://appserver.squiddlefish.com/api/app/?command=getAppData&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041'); > The URL matches the Config Data URL: http://appserver.squiddlefish.com/api/app/?command=getAppData&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041 The output of the data URL: {BT_appConfig: { BT_items:[ {itemId:EAA4BD7BD6ED14F629375CE51, itemType:BT_app, buzztouchAppId:EAA4BD7BD6ED14F629375CE51, buzztouchAPIKey:5F88AB6C5767E0B2FD0A5D0, dataURL:http://appserver.squiddlefish.com/api/app/?command=getAppData&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041, reportToCloudURL:http://appserver.squiddlefish.com/api/app/?command=reportToCloud&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041&deviceId=[deviceId]&deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]&, name:TestApp, version:2.0, startLocationUpdates:0, allowRotation:largeDevicesOnly, BT_themes:[{backgroundColor:#FFFFFF} ], BT_tabs:[ ], BT_screens:[ ] } ] } } Which matches the data in the BT_config.txt file: {BT_appConfig: { BT_items:[ {itemId:EAA4BD7BD6ED14F629375CE51, itemType:BT_app, buzztouchAppId:EAA4BD7BD6ED14F629375CE51, buzztouchAPIKey:5F88AB6C5767E0B2FD0A5D0, dataURL:http://appserver.squiddlefish.com/api/app/?command=getAppData&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041, reportToCloudURL:http://appserver.squiddlefish.com/api/app/?command=reportToCloud&appGuid=EAA4BD7BD6ED14F629375CE51&apiKey=5F88AB6C5767E0B2FD0A5D0&apiSecret=DB09D432CC543CF6EE74041&deviceId=[deviceId]&deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]&, name:TestApp, version:2.0, startLocationUpdates:0, allowRotation:largeDevicesOnly, BT_themes:[{backgroundColor:#FFFFFF} ], BT_tabs:[ ], BT_screens:[ ] } ] } } So don't know why the view JSON data is not loading on the 'Configuration Data' page ???
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/28/11 01:43 PM (12 years ago)
Ok...good info. So the Config Data here looks good (for an empty app). Lets focus on why the show-config data screen isn't working. Bear with me, I can't remember how much php / javascript you know. Hollar if it's too crazy. So, when the data screen loads, the BODY tag fires a javascript method: startConfigDownload This method is in the /bt_scripts/app_configData15.js file. All that method does in that file is trigger an AJAX request. The AJAX request (in the background), hits the URL then puts the content in the textarea. So, because this isn't happneing, we'll need to figure out if the AJAQ request is being made at all? Not sure of the best way to do this without remembering your skills. I like to use alert() tags to debug Javascript. Maybe plop an alert tag just under the function getConfigData(){ line in the app_configDtaa15.js file to make sure the method is firing. The idea is that you move the alert() around to see where the javascript is failing. Again, not sure how up for this you are. It's strange that we're even having this talk too, this is a basic screen without much complexitiy, seems like it would just work
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/29/11 11:57 AM (12 years ago)
UPDATE: OK, worked through the app_configData15.js, dropping alert tags in but didn't provide any useful info Then remembered that a previous version I had installed (V 2.08) DID display the JSON data on a prior App built to get to grips with the server console, so, as I have kept ALL zip versions of BT-server, I copied the bt_v15/bt_scripts folder over from the older version and replaced those on v2.1.2 Success! (Well kind of) The JSON config data displays and is validated on JSONlint - Re-downloaded source - re-compiled app Still the same results on the App on both mobile device and emulator, popup box displaying: Somethings not right There was a problem loading the app's configuration data. See the LogCat (console) output in Eclipse. LogCat output: 11-29 18:35:28.995: WARN/ZZ(419): BT_application: validateApplicationData 11-29 18:35:29.569: WARN/ZZ(419): BT_application: validateApplicationData: Zero screens? 11-29 18:35:29.569: WARN/ZZ(419): BT_activity_root: application data is not valid JOSN data? You could try to use an online JSON validator. Several good ones exist online. Exiting App. Not really sure now why the configdataURL is not triggering ?? :(
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/29/11 12:01 PM (12 years ago)
OK...great news. Still doesn't explain why the new version does work? We're releasing an update in the next or two so maybe that will fix the mysterious issue. As far as the alert dialogue..this does make sense. Becuase you are compiling an 'empty app' without any screens listed in the JSON data it thinks something is wrong. The validateApplicationData method in the JAVA code checks to make sure you have a theme and at least one screen. Add a screen...bet it works.
 
steveh6883
buzztouch Evangelist
Profile
Posts: 383
Reg: May 15, 2011
Gosport, UK
3,830
like
11/29/11 03:29 PM (12 years ago)
OK - some measure of success, but turning out to be classic troubleshooting - fix one error, get three more! Adding a simple menu homescreen on non-tabbed layout then re-downloading & recompiling results in a working app! (Well almost) The Global Theme doesn't get applied (neither the specific theme selected or the default theme) even though the theme settings are stipulated in the config.txt file or the generated JSON config - the background remains the device default colour (black - testapp theme background is gradient colours & default theme is white) Tried changing the layout to tabbed to see if dynamic update works (which it does) but when this is done the whole screen then becomes blank with the device default background colour (black) which am now almost sure is what the initial issue was with my proper App, additionally the functionality of the device menu select > refresh data is lost on tabbed layout and the app has to be force stopped then the App restarted to be able to change back to non-tabbed layspecout Lastly, now unable to configure the individual screens as when selecting the screen to configure, it just links back to a page that just gives 2 options - go to app control panel or logout, although this may be due to me messing about with overwriting some of the BT_scripts files - will wait for the next update in a day or two to see if this one is resolved So, 1 step forward, 3 steps back! :) However, I have to say this is an excellent way of gaining a deeper understanding of the mechanics of BT server :) - I think I would much prefer it this way, although there may be a lot of hair pulling, rather than everything going swimmingly well and not really having any insight into what is happening under the hood
 

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.