Maps & Analytics

GOOGLE MAPS

This android project used Google map feature, So you must change API_KEY by yours.

1. You can use GOOGLE_API_KEY from GCM (you can see at previous menu), and by Enable this list API :

Google Cloud Messaging
Google Maps Android API 
Google Maps Directions API  
Google Maps Distance Matrix API 
Google Maps Geocoding API
Google Maps Geolocation API
Google Maps JavaScript API
Google Maps Roads API
Google Places API for Android
Google Places API Web Service

2. Or you can use others API key [ read this ] http://blog.dream-space.web.id/?p=89 # After you get the API_KEY you can placed you API key at android project res/values/strings.xml

<!-- API KEY FOR MAP -->
<string name="api_key">AIzaSyBiB9CCaRZLfRP4bMZc.........</string>

For ActivityMaps.java you need to change zooming location with your own city latitute longitude.

You can change at Constant.java

public static final double city_lat = -6.9174639;
public static final double city_lng = 107.6191228;

GOOGLE ANALYTICS

On version 4.0 we start integrate this app with Google Analytics , here the step to configure Analytics 1. You must obtain Tracking ID , please read this article http://blog.dream-space.web.id/?p=82 2. After you get Tracking ID you can put at file res/xml/app_tracker.xml Please replace UA-7985XXXX-X with your Tracking ID

<resources>
    <!--  The property id associated with this analytics tracker -->
    <string name="ga_trackingId">UA-7985XXXX-X</string>
</resources>

3. For the default we already track all activity page, the information you can see at file res/xml/app_tracker.xml , we've listed all activity. If you change package name don't forget to rename this package too.

<resources>
    . . .
    <screenName name="app.thecity.ActivityFullScreenImage">Full Image Screen</screenName>
    <screenName name="app.thecity.ActivityMain">Main Screen</screenName>
    <screenName name="app.thecity.ActivityMaps">Maps Screen</screenName>
    <screenName name="app.thecity.ActivityPlaceDetail">Place Detail Screen</screenName>
    <screenName name="app.thecity.ActivitySetting">Setting Screen</screenName>
    <screenName name="app.thecity.ActivitySplash">Splash Screen</screenName>
    . . .
</resources>

4. Track custom screen view, event, and exception, you only need to call this method if you want to track, at file data/ThisApplication.java

public void trackScreenView(String screenName) {
   . . .
 }
 
 public void trackException(Exception e) {
   . . .    
 }
 
 public void trackEvent(String category, String action, String label) {
   . . .
 }

Example Call - at AcitivityRecipeDetails.java we call track event to detect what user view :

 // analytics tracking
 ThisApplication.getInstance().trackScreenView("View place : "+place.name);

Last updated