Location Map

buzztouch plugin: Location Map
Version: v1.3
Location maps are used to display a list of pins on a map. Tapping a pin can display driving directions or another screen. The list of locations can come from the project itself, a list you provide in the apps control panel or a data feed from a URL.
works on iOS iOS
works on Android Android
Latest Review
PointerNicks App | 06/12/14 (v1.10)
I have made several Apps that use this Location Map. My Apps put my address book on a live Map on my phone. I've had success with both iOS and Android. It works, and it works well! I have tested my App in Berlin, Bristol, London with 2.0, and Las Veg...
Screenshots
More Information
This plugin uses the devices native mapping functionality to show a list of locations
on map. Locations are markers with a title and sub-title. An optional icon can be
included for each location that loads another screen or shows driving directions when
it's tapped. The control panel allows other advanced adjustments to control the maps
behavior and features.

The list of locations on the map may be individually entered in the control panel or
may come from a remote file. If you're showing more than a dozen or so locations it's
best to use a remote file to supply the location data.

iOS Project
------------------------
4 Objective-C classes (a total of 8 files) are needed.
BT_screen_map.m and .h
BT_mapAnnotation.m and .h
BT_mapZoomLevel.m and .h
BT_mapAnnotationView.m and .h

BT_screen_map.m is the main UIViewController that shows the map. The other classes are
used to produce the individual locations and handle view options and interactivity.

Android Project
------------------------

AN ADJUSTMENT NEED TO BE MADE TO YOUR PROJECT AFTER YOU DOWNLOAD YOUR CODE
BEFORE YOU CAN USE MAPS IN ANDROID

Before the map will work you'll need to obtain two Google Maps API keys for Google Maps.
One is called a Debug key and one a Release key. These do not cost
money but do confuse lots of people. It's easy once you get the hang of it.

Instructions on how to get the API keys are here:

https://www.buzztouch.com/files/howtos/googleapiv2.pdf

BT_screen_map.java is the Activity class that displays the map. The layout is handled by
screen_map.xml. Additionally, several graphic files are needed to show the locations on the map.

Version History
-----------------
v1.3     03/11/2015     iOS, no changes.
                         Android.
                         
                         --Updated code for Android Studio. Android Studio references the
                         Google Map libraries a bit different than Eclipse did and the map code
                         needed small changes to accomodate for this.
                         
                         --Added support to remember the "pan / zoom" position on the map when
                         coming "back" to the map after tapping a details button.
                         
                         --Add support for Share Screenshot. The setting "allowShareScreenshot" allows
                         a user to share an image of the map using the built in Android share options.
                         This may or may not be added for iOS.
                         
                    
v1.2     12/01/2014     iOS, no changes. Android. Fixed "Show Driving Directions" issue on Android.
                         Only one file in this plugin package changed: BT_screen_map.java
v1.11 7/12/2014 (Susan @ Buzztouch)Corrections to the iOS .m file from Smug Wimp. Updated Readme for 3.0.

v1.10 6/7/2014 (Susan@Buzztouch) Fixed iOS bug with driving directions.

v1.9     5/16/2014 (Chris1)
          Fixed bug with Android related to driving directions
v1.8     2/22/2014 (Chris1)
          Fixed issue where itemType of child items was incorrect
v1.7     2/3/2014 (Chris1)
          Added support for changing "Map Type" button color on iOS7+
v1.6     2/3/2014 (Chris1)
          Fixed bug on iOS 3.0 projects where pressing map type buttons would crash the app;
          Updated for 3.0 control panels; Used Javascript instead of PHP for geocaching
v1.3     11/10/2012
          Minor syntax changes to accomodate for Xcode 4.5 compiler warnings.
          Minor changes in .java files to accomodate for Anroid (Google) 2.2 API's compiler warnings.
          Minor UI changes in .php files for control panel.
          Updated Driving Directions routine to use native maps app instead of Google     Maps in Safari.
          

v1.0, 1.1, 1.2 (historical versions, no change details)


JSON Data
------------------------

If you manually enter the location data, the JSON data for this item in the BT_config.txt
includes a child items array holding individual map locations like this....

{
     "itemId":"1111",
     "itemType":"BT_screen_map",
     "itemNickname":"Location Map",
     "navBarTitleText":"Monterey Spots",
     "childItems":[
          {
               "itemId":"loc_1",
               "itemType":"BT_locationItem",
               "title":"Cool Restaurant",
               "subTitle":"1234 Elm Street Anytown CA",
               "latitude":"38.4323",
               "longitude":"-121.2345"
          },
          {
               "itemId":"loc_2",
               "itemType":"BT_locationItem",
               "title":"Another Restaurant",
               "subTitle":"1234 Main Street Anytown CA",
               "latitude":"38.4223",
               "longitude":"-121.5645"
          }
     ]
}

If you provide location data from a remote file there is not childItems array. Instead,
the locations are pulled from a remote file then added to the map.

{
     "itemId":"1111",
     "itemType":"BT_screen_map",
     "itemNickname":"Location Map",
     "navBarTitleText":"Monterey Spots",
     "dataURL":"http://mywebsite.com/locationsForMap.php"
}
     
In this case the locations would come from a backend script at the dataURL. Loading
the dataURL in your browser would produce output like this....

{
     "childItems":[
          {
               "itemId":"D441703507867F328A084DF",
               "itemType":"BT_mapLocation",
               "latitude":"36.600723",
               "longitude":"-121.8928338",
               "title":"Location 1",
               "subTitle":"234 Del Monte Blvd Monterey CA 93940"
          },
          {
               "itemId":"419993F0FEC3312C797C91E",
               "itemType":"BT_mapLocation",
               "latitude":"36.615763",
               "longitude":"-121.904234",
               "title":"Location 2",
               "subTitle":"801 Lighthouse Ave Monterey CA 93940"
          },
          {
               "itemId":"11F25D4F6120F19E7F4B220",
               "itemType":"BT_mapLocation",
               "latitude":"36.5977439",
               "longitude":"-121.8949035",
               "title":"Location 3",
               "subTitle":"823 Alvarado St Monterey CA 93940"
          }
     ]
}