Buzztouch & Google Maps (Android)

Buzztouch & Google Maps API Key: Keytool + Enabling “Get Driving Directions”

Additional Articles

PART ONE: Create Map Screen in Buzztouch

  • Create a map in Buzztouch using the Location Map Screen.
  • Enter a location
  • Submit the location
  • Download Source code (If you haven’t already done so.)
  • (Skip if you already have a Keystore & Release Key. If not get one. This How-To is for use with the Release Key, so if you haven’t exported your app do that now. Why? Because I’m the process of doing so, you’ll create a release key you’ll need in just a bit.
  • Warning: Using the Debug key only creates problems and will PREVENT the map from working. So, DON'T USE IT! (OK, Use Debug Key as appropriate, but NOT WITH THESE INSTRUCTIONS. Glad we cleared that up.)

PART TWO: Install Eclipse KeyTool.

  • Open Eclipse
  • Go to Help > Install New Software.
  • Now enter the following URL into the textbox:

http://keytool.sourceforge.net/update

  • Wait until the word “Keytool” appears under the “Name” table then click on the check box before it.
  • Then click on “Next” and continue clicking on Next until you’re finished with the installation. You will know that the installation is complete because you’ll find a new tab in the Eclipse Menu bar called “Keytool“.

PART THREE: Obtaining & using the Google Maps API Key.

  • Obtain your Release Certificate’s MD5 Fingerprint using the Keytool in Eclipse.

Steps To Obtain the MD5 Fingerprint:

Click on KeyTool

Click on Open Keystore

Browse to the Keystore you wish to use, and double click

Enter password

The KeyStore will appear and ckick on the indicator just to the left of the Keystore

A lock will appear, double ckick on it.

  • You need a Google Account to get a Maps API key, and your API key will be connected to your Google Account.
  • Sign Up for the Android Maps API Key.
  • A single Maps API key is valid for all applications signed by a single certificate
  • You can get different Maps API Keys for different certificates.
  • Read and agree with the terms and conditions Android Maps APIs Terms of Service.
  • Enter your Release certificate’s MD5 fingerprint: 00:35:C2:48:65:41:CG:55:41:11:17:F1:4C :11:82:C5
  • Click on the Generate API Key
  • Result: 0Dfgh96574gffd655Cp6QbltMARFH
  • Copy and paste the Key in the strings.xml file.
  • BTv1.4, BTv1.5 & BTv2.0? This file is located as follows:

Source Code files >res folder > values folder > strings.xml file

  • In the strings file you’ll find:

<string name=“googleMapsAPIKeyRelease”>
yourGoogleMapsKeyForRelease</string>

  • Copy and paste your Maps API Key in the black text seen above.
  • The result will look as follows:

<string name=“googleMapsAPIKeyRelease”>
0Dfgh96574gffd655Cp6Qblt</string>

  • Save and close the file. (Hint: Want to use Facebook for BTv1.4 take a look around before you close. Yes, it’s that easy.)

PART IV: Additional Modifications

  • Be sure the AndroidManifest.xml debuggable setting is set to “false“.
  • In the AndroidManifest.xml uncomment the maps code (may be optional for BTv1.5, I didn’t need to do this, so I recommend you skip this step for BTv1.5)

For BTv1.4 line 68 – 72

In the AndroidManifest.xml (in the root of the project), uncomment the Google map library information by removing the <!– and the –> near the very end of AndroidManifest.xml file, all the way at the bottom, it looks like this:

BEFORE:      <!–

       <uses-library android:name=”com.google.android.maps” />

       <activity android:name=”.Screen_LocationMap” android:label=”@string/app_name” android:screenOrientation=”sensor”></activity>

        –>

  • AFTER:  IF GOOGLE MAPS ARE USED, UNCOMMENT THIS AND SEE THE INSTRUCTIONS IN THE README.txt FILE

           <uses-library android:name=”com.google.android.maps” />

           <activity android:name=”.Screen_LocationMap” android:label=”@string/app_name” android:screenOrientation=”sensor”></activity>

BTv1.4 ONLY: (THIS NEEDS TO BE STUDIED, DON’T DO THIS) In the Act_ActivityBase.java file, inside the src/yourProjectName folder, in the ShowLocationMap() function, uncomment the warning and the function call. It looks like this (lines 289 – 292 it’s about half way down the file)

  • BEFORE: //showLocationMap

public void showLocationMap(){

/*

Intent theIntent = new Intent(this, Screen_LocationMap.class);

        startActivity(theIntent);

        */

showAlert(“Maps Not Configuredr“, “Maps not configured properley. See: showLocationMap() method in src/Act_ActivityBase.java”);

}

Remove the /* and the */ and the “showAlert” warning.

  • AFTER: Intent theIntent =new Intent(this, Screen_LocationMap.class);

            startActivity(theIntent);

  • * * *END OF BTv1.4 Only Section * * *

  • Modify the following file from Debug to Release:
  • Source Code> res> layout>screen_locationmaps.xml
  • From: apiKey=@string/googleMapsAPIKeyDebug
  • To:    apiKey=@string/googleMapsAPIKeyRelease
  • (Optional) In Act_ActivityBase.java uncomment the ShowLocationMap() code and removed the warning (may be optional, didn’t need to do this, so I recommend you skip this step.)
  • Reminder: Prior to Uploading to Android Market, modify the manifest.xml
  • Increase the VersionCode by 1
  • example from 3 to 4
  • and
  • increased the VersionName by one
  • example from 1.7 to 1.8 .
  • (Optional) Reset the Core properties in the Buzztouch Control panel to turn on the GPS on launch of the App. (You must enable this if you wish for the app to use the GPS.)

Enable “Get Driving Directions” (Optional):

  • Modify one line (#593) in the BT_screen_map.java file.
  • App’s Source Code > src > com.yourappsname > BT_screen_map.java
  • Line 593 prior to modificaton:

Uri uri = Uri.parse(“http://maps.google.com/maps?saddr=”; + tmpLatitude + “,” + tmpLongitude + “&daddr=”+ tmpLatitude + “,” + tmpLongitude +);

  • Line 593 after Modification:

Uri uri = Uri.parse(“http://maps.google.com/maps?saddr=”; + tmpLatitude + “,” + tmpLongitude + “&daddr=”+ tappedLocation.getLatitude() + “,” + tappedLocation.getLongitude());

  • Tip: Double-click the java file to open it in Eclipse. Then right-click on the left edge of the view screen where the files opens and a pop-up menu let you turn on-line numbers.
  • Export the Apk to Android Market and/or installed on your device.
  • Test, Test and TEST some more to make sure everything went according to plan.

Show User Current Location:

  • The follow is mostly unedited from Zakamo’s post (see orignal below)
  • Add this code:
  • me=new MyLocationOverlay(this, mapView);
  • mapView.getOverlays().add(me);
  • me.enableMyLocation();
  • to the if statement area here: // add device location if we have it and showUserLocation != “0″ By adding it to the if statement, we should allow for enabling from console.
  • I nuked all of the user location stuff so the phone won’t come up.
  • It should be noted that you are stuck with the blue dot.
  • No custom stuff, but this is a bit cleaner in my opinion.
  • It appears like 2.0 and 1.5 it will be the same.
  • BT_screen_map.java Search for the comment above but looks like to be around line 745ish.
    We need to add some declarations, sorry I forgot that. Go to where all the variables are being called at the top,
  • and add private MyLocationOverlay me=null;
  • Also you want to add the original code after the if statement opens.
  • So like this. //add device location if we have it and showUserLocation != “0″ if(tmpLatitude.length() > 4 && !showUserLocation.equalsIgnoreCase(“0″)){ me=new MyLocationOverlay(this, mapView); mapView.getOverlays().add(me); me.enableMyLocation();
    If for some reason it doesn’t work, change tmpLatitude.length() > 4 to tmpLatitude.length() > 0

Additional Readings:

Just in Case: The MD5 Fingerprint and API Key used in this post are not functional and are merely for illustration, and using these will not work. ;-)

Using JSON data to create map locations:

Location maps are used to show one or more pins on a map. Each location can be configured with an additional action that occurs when the callout bubble is tapped. The list of locations can can come from the screens configuration data or a remote file hosted on a backend server. Hosting the locations on a remote server allows for dynamic changes. This sample text file shows the format of a remote file of locations. Sample JSON {“itemId”:”99999″, “itemType”:”BT_screen_map”, “itemNickname”:”Location Map”, “navBarTitleText”:”Monterey Spots”, “dataURL”:”http://mywebsite.com/locationsForMap.php&#8221;}

Location Map Properties

Item Id * “itemId”:”a unique id” A unique number or string identifying this item from all other items in the configuration file.

Item Type * “itemType”:”BT_screen_map” Used by the mobile app to determine what type of item to create.

Item Nickname * “itemNickname”:”A unique nickname” The nickname of the item in the buzztouch control panel.

Child Items “childItems”:[Array of Map

Also this if for android, but assume similar code exists for iOS.
Look in your BT_sceen_map.java file
Find this:
//parse screenData…
Here its going to check out your JSON for that screen, and put into an array called items. It then breaks down items (JSON stuff) in the lines after to the respective nodes for the application later on.
Your mission would be to modify this code for it to take your GeoRSS. If this is your only map screen, then you could start by feeding your feed vs JSON stuff, but a ton of modification will probably need to take place to get it everything lined up correct. It will not be a cut and paste type job.
If you had multiple map screens, you would have to be on BT 2.0, as you would need to rewrite the plugin screen to have a field for your GeoRSS. If present, you would have the plugin bypass the json parse and move to the GeoRSS parse.
That’s all i got, perhaps someone else might be able to assist more. Zakamo

Acknowledgements:

ATRAIN53 made me aware of Eclipse Keytool

LorenH from the Buzztouch Forum provided the solution to the “Get Driving directions”.

Zackamo Aspiring developer Profile Posts: 159 Reg: Oct 25, 2011 Bryan TX

1,590
like
03/11/12 05:08 AM (6 days ago)
Boom. Android way of doing current location.
Add this code: me=new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(me); me.enableMyLocation();
to the if statement area here: // add device location if we have it and showUserLocation != “0″
By adding it to the if statement, we should allow for enabling from console.
I nuked all of the user location stuff so the phone won’t come up.
It should be noted that you are stuck with the blue dot. No custom stuff, but this is a bit cleaner in my opinion.
It appears like 2.0 and 1.5 it will be the same.
BT_screen_map.java
Search for the comment above but looks like to be around line 745ish.
We need to add some declarations, sorry I forgot that..
Go to where all the variables are being called at the top, and add private MyLocationOverlay me=null;
Also you want to add the original code after the if statement opens.
So like this.
//add device location if we have it and showUserLocation != “0″
if(tmpLatitude.length() > 4 && !showUserLocation.equalsIgnoreCase(“0″)){ me=new MyLocationOverlay(this, mapView); mapView.getOverlays().add(me); me.enableMyLocation();If for some reason it doesn’t work, change
tmpLatitude.length() > 4 to tmpLatitude.length() > 0In all reality you can put the code I gave you it almost any of the main functions for this file and it should work. My goal was to have it play with current buzztouch thought process correctly.

Adding multiple map locations to a Buzztouch app:

Several methods:

1. batchgeo.com will create a multiple location map if you have all the locations in a Tab-delimited spreadsheet. From there you can get the custom URL to the map and use that in BuzzTouch.

2. Multi Pin Map Workaround

3. Here’s a video By forestryforum “Using Google Earth and Google maps to create and execute a .kmz file via your phone app”.

Here’s his post explaining what he did.

My summary of his post:

1. Create a map on our online forum where members can add themselves. It is only accessible by members.

2. Use this map feature also provides a download link of the current data in a .kml file that you can open with Google Earth.

3. upload that file to an accessible webserver

4. then take the address of the file to google maps and put it in the search, it will open up all of your locations on a google map.

5. Google maps creates a URL link, or an embed link that you can use. You can also choose the option to have it create a short link for you.

6. Place the link in your App custom url screen.

4/21/12 post by David @ Buzztouch,
Another idea: Have a look at the sample data for locations in the v1.5 documentation. Assuming you’re using BT v2.0.
a) make a copy of that file.
b) Upload it to your file manager.
c) “Point” to that file with using the Data URL property of the map screen.
d) Test to make sure it works as expected.
e) Add additional locations to the file as needed from your real data.
***************************************************
From Forum post by @geo3d:
Re: Location In a nutshell;
1) Fine = GPS location
2) coarse = WiFI

Here’s a thought regarding your map; if you plan on using location services for your users you could implement a Google Static Map which just loads, you guessed it -a static map; but allows for use of GPS devices: https://developers.google.com/maps/documentation/staticmaps/

Using static map allows the ease of just pointing to a URL; and with Buzztouch’s custom url plugin its an ease to implement.

Or you could create your own map with such free products as Quantum GIS for example

8 thoughts on “Buzztouch & Google Maps (Android)

  1. Hiya
    Am trying to get my Release Certificate’s MD5, but not too sure how to actualise your directions above, could you help please?

    Basically the confusion i think stems from Mykeystore / Alias, both of which i already have, and its relationship with “Keytool” which i already have on my eclipse Menu bar as described in your narrative above.

    So, i then Go to Keytool > Create a new certicate (right?), and it seems to want to create me a new certificate?

    Is it the Release Certificate for MD5 that its creating then? Not been made clear makes me hesitate….

    Any suggestion, or even more guidance appreciated please

  2. Bravo!

    Worked like a dream. Having spent the whole day swotting on loadsa detail, a little more complexity was simply doing ma head in.

    Thanks for the clarification

  3. Me again, just another clarification sought;
    I am using BTv2.0

    and i added;

    below the;

    I hope thats the right thing to do? I have saved it, but can always delete if its wrong

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s