Discussion Forums  >  Maps, Device Location, Tracking

Replies: 5    Views: 230

juk
Aspiring developer
Profile
Posts: 29
Reg: Feb 16, 2014
York, UK
890
03/31/14 06:36 AM (10 years ago)

Listing nearby attractions in an offline app

Hello. I'm James from the UK. Firstly, to David, the team, and the other people helping on here, Buzztouch is just a fantastic platform and community - so, thanks, and it's good to be a small part of it. Anyway, to my question. Feel free to tell me off and point me at an existing post if there is one, although I did check. From watching one of David's videos I'm familiar with using a device's location (merge fields) to return a list of nearby points using server-based PHP and MySQL. I would like to achieve a similar result in an offline app but without creating custom plugins (I don't feel ready yet) and without limiting my chances of Apple acceptance. I imagine its a case of passing the merge fields to a local Custom HTML file which includes some Javascript containing a proximity function to extract a list of nearby entries from a local JSON file (.txt?). Does that seem feasible? Is there a better or more App Store friendly approach? By the way, it will be a fairly limited data set so I'd be happy to use JSON (or similar) rather than a database. Many thanks James
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/31/14 06:58 AM (10 years ago)
This can certainly be done, but would require a good deal of custom work. When you do it online, I'm assuming you're using the php to query a database using the user's coordinates as a search parameter and a formula to see what's inside a range. To do this offline you'll want to use the same approach. But that means creating a database on the device and having some code that queries against that database. Take a look at the BT_database class. It makes that process a lot easier.
 
juk
Aspiring developer
Profile
Posts: 29
Reg: Feb 16, 2014
York, UK
890
like
03/31/14 07:19 AM (10 years ago)
Hi Chris. Yes, the online PHP approach you mention is the one I've seen used. When you say, "creating a database on the device", was I right in assuming that could be as simple as using a JSON based text file containing all the entries? I'll take a look at the BT_database class anyway. Also, when you say, "a good deal of custom work", do you mean custom plugins, or just custom HTML? This will be my first app, so I'd like to keep it simple as possible.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/31/14 07:26 AM (10 years ago)
Chris is pretty much correct. the Best apps usually are 'connected' to a database that can serve up accurate information when needed. I live on an island, and data plans are not as popular as elsewhere. A LOT of my users are normally 'offline' with their smartphones, only getting network connections when they're near a hotspot, or at home. Because of this, I've been working to create as much 'offline' content as possible. Granted, some of my work is extremely customized (offline maps for example, alleviating the need for Apple or Google maps to provide accurate mapping for users), however If your data doesn't change too much, there is merit in having an 'external childItem file' rather than pulling data from an online connection. The main difference is, the 'external childItem' file will need to be created and place 'inside' the app, rather than pulled from a database. In my earlier trials, I would create several different childItem files, depending on the results I needed, such as 'all hotels' or 'restaurants', and link them with the menu. http://www.buzztouch.com/docs/v1.5/childItems.php If you give it some thought, you can creatively achieve what you're after albiet somewhat limited at first. But as your experience grows (and mine, lol! I've got some great location based plugins in the pipeline) you're recognize how to harness the power of a lot of 'seemingly' simple plugins, that actually can provide some amazing results. As you get more experience and get more comfortable, there are methods that will also allow you to dynamically create new screens on the fly from your json childItem file, but that's a fairly advanced topic; better to get a grip with some of the basic stuff first. Good Luck, and let us know what your thoughts are; we'll try and steer you to the 'most bang for the buck'. Cheers! -- Smug
 
juk
Aspiring developer
Profile
Posts: 29
Reg: Feb 16, 2014
York, UK
890
like
03/31/14 10:29 AM (10 years ago)
Thanks Smug, that's really useful. I hadn't really explored childItems. I like your suggestion about using the existing plugins creatively! Let me run a quick idea past you and others if I may... Firstly I want to create some childItem JSON dynamically. Unless anyone can see any major issues, I think I'm happy doing this using Javascript in a Custom HTML screen. Assuming that bit works, my question is can I then pass that JSON as a parameter to a Simple Menu (or similar) or can its content only ever come from a static Data URL (or the Control Panel)? Thanks James
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
03/31/14 06:13 PM (10 years ago)
You should be able to do it with a local HTML file containing JavaScript to process the JSON. Using a URL scheme, you can pass parameters to any screen (plugin). However, you will have to modify the plugin to take action on the passed parameter. Go to https://www.buzztouch.com/resources and look for the word "scheme". That document tells you how to setup a URL Scheme for an app. Then go to http://iDev101.com for tips on passing and processing parameters. Baby steps ... Crawl, walk, then run. You can do it! :-) -- Niraj
 

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.