Discussion Forums  >  Maps, Device Location, Tracking

Replies: 1    Views: 226

baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
09/26/12 05:07 PM (11 years ago)

Help with data URLs / location (Bug for David?)

Hey guys I need some help. I have been hacking away at this for a couple of days with no luck - I feel what I need should be pretty simple, but it doesn't seem that way (at least for me!) This is an iOS app on BT Server 2.0 Basically the first screen on my app is a custom URL screen that obtains the users location through the data url merge and returns some output through a server php script I have set up. The problem occurs that the location manager has not updated the location before the custom url screen loads so I get the following merged url: deviceLatitude=0&deviceLongitude=0 I have set the accuracy in location manager to ThreeKilometers (I don't need exact location) so this should speed it up a bit but still not enough. Ideally what I need is a way to pause loading of the custom url screen until a location is updated. Alternatively on a previous similar v1.5 app I hacked around this by adding in a redirect: i.e. The custom url page (page1) would redirect to another page (page2) page2 would check using javascript to see if deviceLatitude or deviceLongitude = 0, if they did it would go back to page1 (using javascript)and loop until the location was updated at which point the output was produced by page2 This worked ok in my previous 1.5 app, however in my new 2.0 app this doesn't seem to work - it appears that the redirect just returns to the already merged url, rather than the raw data url and then re-merging the BT variables. So I tried another option, instead of using javascript to 'go back' from page2 I used javascript to redirect to the raw data url of page1 (i.e. page1?deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]) However, this didn't work, I believe due to a couple of reasons: 1) URL encoding - The '[]' were encoded 2) The BT Variables are not merged into any subsequent links I finally tried hacking around in the code: I believe NSURL *url = request.URL; is the line which gets the url of any further links. I have tried merging using 'BT_strings mergeBTVariablesInString' but can't get this to work. I have also tried appending the string '?deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]' to the url first to avoid the url encoding - again with no luck As I said this is 'hacking' with the code and is probably not right at all!!! Finally in desparation and to check to see if there were errors in my javascript/html/php code I included a buzztouch bottom toolbar with refresh and back buttons. This still did not work - for example refreshing the screen only refreshed the initially merged location, even if the device location had changed. This was tested using console - the device would report to cloud with new lat and long - so I knew it had them but refreshing the screen gave a url with the old coordinates. Ideally I would like some help with a solution to my issue but if nothing else I believe the final part of my lengthy!! post shows a bug.
 
baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
like
09/27/12 03:37 AM (11 years ago)
Anyone, any ideas on this?!
 

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.