Add google analytics

This commit is contained in:
Victor Shcherb 2012-01-14 13:01:01 +01:00
parent 5f7441b206
commit 5a038c317f
14 changed files with 103 additions and 46 deletions

View file

@ -14,6 +14,8 @@ public class Version {
public static final String APP_MAP_CREATOR_VERSION = APP_MAP_CREATOR_NAME + " " + APP_VERSION; //$NON-NLS-1$
public static final String APP_FULL_NAME = APP_NAME + " " + APP_VERSION + " " +APP_DESCRIPTION; //$NON-NLS-1$ //$NON-NLS-2$
public static final String APP_MAP_CREATOR_FULL_NAME = APP_MAP_CREATOR_NAME + " " + APP_VERSION + " " +APP_DESCRIPTION; //$NON-NLS-1$ //$NON-NLS-2$
public static String getVersionAsURLParam() {
try {

View file

@ -8,5 +8,7 @@
<classpathentry kind="lib" path="lib/tuprolog.jar"/>
<classpathentry kind="lib" path="lib/junidecode-0.1.jar"/>
<classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar"/>
<classpathentry kind="lib" path="lib/libGoogleAnalytics.jar"/>
<classpathentry kind="lib" path="lib/EasyTracker.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View file

@ -3,17 +3,23 @@
package="net.osmand.plus" android:installLocation="auto" android:versionName="0.7.0" android:versionCode="44">
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIqF3tNGT66etVBn_vgzpfAY1wmIzKV1Ss6Ku-2A" />
<!-- comment change build properties for release & set targetSdkVersion="7", build and reverse changes-->
<!-- <uses-sdk android:minSdkVersion="3"/> -->
<!-- uncomment it to allow different screen supports (large/small)-->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description"
android:backupAgent=".OsmandBackupAgent" android:restoreAnyVersion="true">
<activity android:name=".activities.MainMenuActivity"
android:debuggable="true" android:name="net.osmand.plus.activities.OsmandApplication" android:description="@string/app_description"
android:backupAgent="net.osmand.plus.OsmandBackupAgent" android:restoreAnyVersion="true">
<activity android:name="net.osmand.plus.activities.MainMenuActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait"
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait"
android:launchMode="singleTop">
<intent-filter>
<data android:scheme="http" android:host="download.osmand.net" path="go"/>
@ -22,48 +28,52 @@
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
<activity android:name=".activities.SettingsActivity" android:label="@string/settings_activity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".activities.search.SearchActivity" android:label="@string/search_activity" ></activity>
<activity android:name=".activities.NavigatePointActivity"></activity>
<activity android:name=".activities.DownloadIndexActivity" android:configChanges="keyboardHidden|orientation" android:label="@string/local_index_download"></activity>
<activity android:name=".activities.ShowRouteInfoActivity" android:label="@string/route_about"></activity>
<activity android:name=".activities.FavouritesListActivity"></activity>
<activity android:name=".activities.FavouritesActivity" android:label="@string/favourites_activity"></activity>
<activity android:name=".activities.ContributionVersionActivity" android:label="@string/contribution_activity"></activity>
<activity android:name="net.osmand.plus.activities.SettingsActivity" android:label="@string/settings_activity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchActivity" android:label="@string/search_activity" ></activity>
<activity android:name="net.osmand.plus.activities.NavigatePointActivity"></activity>
<activity android:name="net.osmand.plus.activities.DownloadIndexActivity" android:configChanges="keyboardHidden|orientation" android:label="@string/local_index_download"></activity>
<activity android:name="net.osmand.plus.activities.ShowRouteInfoActivity" android:label="@string/route_about"></activity>
<activity android:name="net.osmand.plus.activities.FavouritesListActivity"></activity>
<activity android:name="net.osmand.plus.activities.FavouritesActivity" android:label="@string/favourites_activity"></activity>
<activity android:name="net.osmand.plus.activities.ContributionVersionActivity" android:label="@string/contribution_activity"></activity>
<activity android:name=".activities.search.SearchPOIActivity" android:label="@string/searchpoi_activity"></activity>
<activity android:name=".activities.search.SearchPoiFilterActivity"></activity>
<activity android:name=".activities.search.SearchAddressOnlineActivity"></activity>
<activity android:name=".activities.search.SearchAddressActivity"></activity>
<activity android:name=".activities.search.SearchTransportActivity"></activity>
<activity android:name=".activities.search.SearchHistoryActivity"></activity>
<activity android:name=".activities.search.SearchCityByNameActivity"></activity>
<activity android:name=".activities.search.SearchRegionByNameActivity"></activity>
<activity android:name=".activities.search.SearchStreetByNameActivity"></activity>
<activity android:name=".activities.search.SearchStreet2ByNameActivity"></activity>
<activity android:name=".activities.search.SearchBuildingByNameActivity"></activity>
<activity android:name=".activities.EditPOIFilterActivity"></activity>
<activity android:name=".activities.search.GeoIntentActivity"><intent-filter><action android:name="android.intent.action.VIEW"></action>
<activity android:name="net.osmand.plus.activities.search.SearchPOIActivity" android:label="@string/searchpoi_activity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchPoiFilterActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchAddressOnlineActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchAddressActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchTransportActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchHistoryActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchCityByNameActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchRegionByNameActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchStreetByNameActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchStreet2ByNameActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.SearchBuildingByNameActivity"></activity>
<activity android:name="net.osmand.plus.activities.EditPOIFilterActivity"></activity>
<activity android:name="net.osmand.plus.activities.search.GeoIntentActivity"><intent-filter><action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<data android:scheme="geo"></data>
</intent-filter>
</activity>
<activity android:name=".activities.TestVoiceActivity"></activity>
<activity android:name=".activities.LocalIndexesActivity" android:label="@string/local_index_descr_title"></activity>
<service android:process="net.osmand.plus" android:label="@string/process_navigation_service" android:name=".NavigationService">
<activity android:name="net.osmand.plus.activities.TestVoiceActivity"></activity>
<activity android:name="net.osmand.plus.activities.LocalIndexesActivity" android:label="@string/local_index_descr_title"></activity>
<service android:process="net.osmand.plus" android:label="@string/process_navigation_service" android:name="net.osmand.plus.NavigationService">
<intent-filter><action android:name="net.osmand.plus.NavigationService"></action></intent-filter>
</service>
<receiver android:name=".OnNavigationServiceAlarmReceiver"/>
<receiver android:name="net.osmand.plus.OnNavigationServiceAlarmReceiver"/>
<!-- Used for install referrer tracking -->
<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
<!-- comment change build properties for release & set targetSdkVersion="7", build and reverse changes-->
<!-- <uses-sdk android:minSdkVersion="3"/> -->
<!-- uncomment it to allow different screen supports (large/small)-->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>

BIN
OsmAnd/lib/EasyTracker.jar Normal file

Binary file not shown.

Binary file not shown.

View file

@ -28,6 +28,8 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import net.osmand.IProgress;
import net.osmand.data.IndexConstants;
import net.osmand.plus.DownloadOsmandIndexesHelper;
@ -95,6 +97,9 @@ public class DownloadIndexActivity extends ExpandableListActivity {
private TextWatcher textWatcher ;
private EditText filterText;
private DownloadFileHelper downloadFileHelper = null;
private GoogleAnalyticsTracker tracker;
@Override
@ -102,6 +107,11 @@ public class DownloadIndexActivity extends ExpandableListActivity {
super.onCreate(savedInstanceState);
// recreation upon rotation is prevented in manifest file
setContentView(R.layout.download_index);
tracker = GoogleAnalyticsTracker.getInstance();
// Start the tracker in manual dispatch mode...
tracker.startNewSession(getString(R.string.ga_api_key), 60, this);
downloadFileHelper = new DownloadFileHelper(this);
findViewById(R.id.DownloadButton).setOnClickListener(new View.OnClickListener(){
@ -301,7 +311,11 @@ public class DownloadIndexActivity extends ExpandableListActivity {
switch (id) {
case DIALOG_PROGRESS_FILE:
DownloadIndexesAsyncTask task = new DownloadIndexesAsyncTask(new ProgressDialogImplementation(progressFileDlg,true));
task.execute(entriesToDownload.keySet().toArray(new String[0]));
String[] indexes = entriesToDownload.keySet().toArray(new String[0]);
for(String index : indexes) {
tracker.trackEvent("Downloads", index, "file", 50);
}
task.execute(indexes);
break;
case DIALOG_PROGRESS_LIST:
downloadListIndexThread.setUiActivity(this);

View file

@ -6,6 +6,8 @@ package net.osmand.plus.activities;
import java.util.Comparator;
import java.util.List;
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
import net.osmand.FavouritePoint;
import net.osmand.OsmAndFormatter;
import net.osmand.osm.LatLon;
@ -33,7 +35,7 @@ import android.widget.TextView;
/**
*
*/
public class FavouritesListActivity extends ListActivity implements SearchActivityChild {
public class FavouritesListActivity extends TrackedListActivity implements SearchActivityChild {
public static final String SELECT_FAVORITE_POINT_INTENT_KEY = "SELECT_FAVORITE_POINT_INTENT_KEY";
public static final int SELECT_FAVORITE_POINT_RESULT_OK = 1;

View file

@ -4,6 +4,8 @@ import java.io.File;
import java.text.MessageFormat;
import java.util.Random;
import com.google.android.apps.analytics.easytracking.TrackedActivity;
import net.osmand.Version;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@ -37,7 +39,7 @@ import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.TextView;
public class MainMenuActivity extends Activity {
public class MainMenuActivity extends TrackedActivity {
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$

View file

@ -4,6 +4,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.google.android.apps.analytics.easytracking.TrackedActivity;
import net.osmand.Algoritms;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
@ -59,7 +61,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.provider.Settings.Secure;
import android.util.Log;
import android.view.KeyEvent;
@ -75,7 +76,7 @@ import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.Toast;
public class MapActivity extends Activity implements IMapLocationListener, SensorEventListener {
public class MapActivity extends TrackedActivity implements IMapLocationListener, SensorEventListener {
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
private static final String GPS_STATUS_COMPONENT = "com.eclipsim.gpsstatus2"; //$NON-NLS-1$

View file

@ -5,6 +5,9 @@ import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.StringTokenizer;
import com.google.android.apps.analytics.easytracking.TrackedActivity;
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
import net.osmand.LogUtil;
import net.osmand.osm.LatLon;
import net.osmand.osm.MapUtils;
@ -27,7 +30,7 @@ import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
public class NavigatePointActivity extends Activity implements SearchActivityChild {
public class NavigatePointActivity extends TrackedActivity implements SearchActivityChild {
Dialog dlg;
MapActivity activity;
int currentFormat = Location.FORMAT_DEGREES;

View file

@ -2,6 +2,9 @@ package net.osmand.plus.activities.search;
import java.util.List;
import com.google.android.apps.analytics.easytracking.TrackedActivity;
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
import net.osmand.OsmAndFormatter;
import net.osmand.osm.LatLon;
import net.osmand.osm.MapUtils;
@ -25,7 +28,7 @@ import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
public class SearchHistoryActivity extends ListActivity implements SearchActivityChild {
public class SearchHistoryActivity extends TrackedListActivity implements SearchActivityChild {
private LatLon location;
private SearchHistoryHelper helper;
private Button clearButton;

View file

@ -6,6 +6,8 @@ package net.osmand.plus.activities.search;
import java.util.ArrayList;
import java.util.List;
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
import net.osmand.osm.LatLon;
import net.osmand.plus.NameFinderPoiFilter;
import net.osmand.plus.OsmandSettings;
@ -16,7 +18,6 @@ import net.osmand.plus.ResourceManager;
import net.osmand.plus.SearchByNameFilter;
import net.osmand.plus.activities.EditPOIFilterActivity;
import net.osmand.plus.activities.OsmandApplication;
import android.app.ListActivity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
@ -35,7 +36,7 @@ import android.widget.Toast;
* @author Maxim Frolov
*
*/
public class SearchPoiFilterActivity extends ListActivity {
public class SearchPoiFilterActivity extends TrackedListActivity {
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT;
public static final String SEARCH_LON = SearchActivity.SEARCH_LON;

View file

@ -7,6 +7,8 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import com.google.android.apps.analytics.easytracking.TrackedListActivity;
import net.osmand.Algoritms;
import net.osmand.OsmAndFormatter;
import net.osmand.data.TransportRoute;
@ -40,10 +42,9 @@ import android.widget.ProgressBar;
import android.widget.TextView;
/**
* @author Maxim Frolov
*
*/
public class SearchTransportActivity extends ListActivity implements SearchActivityChild {
public class SearchTransportActivity extends TrackedListActivity implements SearchActivityChild {
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT;
public static final String SEARCH_LON = SearchActivity.SEARCH_LON;

16
config/site/autoload.php Normal file
View file

@ -0,0 +1,16 @@
<?php
spl_autoload_register(function($className) {
if($className[0] == '\\') {
$className = substr($className, 1);
}
// Leave if class should not be handled by this autoloader
if(strpos($className, 'UnitedPrototype\\GoogleAnalytics') !== 0) return;
$classPath = strtr(substr($className, strlen('UnitedPrototype')), '\\', '/') . '.php';
require(__DIR__ . $classPath);
});
?>