Skip to content

Commit

Permalink
Remove Google Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
oaliaga committed Apr 14, 2014
1 parent 0168735 commit b4d9aaf
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 45 deletions.
Binary file removed libs/libGoogleAnalytics.jar
Binary file not shown.
6 changes: 0 additions & 6 deletions src/com/prey/activities/AddDeviceToAccountActivity.java
Expand Up @@ -22,7 +22,6 @@
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import com.prey.PreyAccountData;
import com.prey.R;
import com.prey.exceptions.NoMoreDevicesAllowedException;
Expand Down Expand Up @@ -183,11 +182,6 @@ protected void onPostExecute(Void unused) {
String message = getString(R.string.device_added_congratulations_text);
Bundle bundle = new Bundle();
bundle.putString("message", message);
GoogleAnalyticsTracker.getInstance().trackEvent(
"Device", // Category
"Added", // Action
"", // Label
1);
Intent intent = new Intent(AddDeviceToAccountActivity.this, PermissionInformationActivity.class);
intent.putExtras(bundle);
startActivity(intent);
Expand Down
6 changes: 0 additions & 6 deletions src/com/prey/activities/CreateAccountActivity.java
Expand Up @@ -8,7 +8,6 @@

import android.app.AlertDialog;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import com.prey.R;
import android.app.Dialog;
import android.app.ProgressDialog;
Expand Down Expand Up @@ -116,11 +115,6 @@ protected void onPostExecute(Void unused) {
String message = getString(R.string.new_account_congratulations_text, email);
Bundle bundle = new Bundle();
bundle.putString("message", message);
GoogleAnalyticsTracker.getInstance().trackEvent(
"Account", // Category
"Created", // Action
"", // Label
1);
Intent intent = new Intent(CreateAccountActivity.this, PermissionInformationActivity.class);
intent.putExtras(bundle);
startActivity(intent);
Expand Down
11 changes: 0 additions & 11 deletions src/com/prey/activities/PreyActivity.java
Expand Up @@ -10,10 +10,8 @@
import android.os.Bundle;
import android.view.Window;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import com.prey.PreyConfig;
import com.prey.PreyUtils;
import com.prey.analytics.GoogleAnalyticsSessionManager;

public class PreyActivity extends Activity {

Expand All @@ -23,28 +21,19 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);

// Need to do this for every activity that uses google analytics
GoogleAnalyticsSessionManager.getInstance(getApplication()).incrementActivityCount();
}


@Override
protected void onResume() {
super.onResume();

// Example of how to track a pageview event
GoogleAnalyticsTracker.getInstance().trackPageView(getClass().getSimpleName());
}

@Override
protected void onDestroy() {
super.onDestroy();

// Purge analytics so they don't hold references to this activity
GoogleAnalyticsTracker.getInstance().dispatch();

// Need to do this for every activity that uses google analytics
GoogleAnalyticsSessionManager.getInstance().decrementActivityCount();
}

/*
Expand Down
6 changes: 0 additions & 6 deletions src/com/prey/activities/WelcomeBatchActivity.java
Expand Up @@ -12,7 +12,6 @@
import android.os.AsyncTask;
import android.os.Bundle;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import com.prey.PreyAccountData;
import com.prey.PreyConfig;
import com.prey.R;
Expand Down Expand Up @@ -67,11 +66,6 @@ protected void onPostExecute(Void unused) {
String message = getString(R.string.device_added_congratulations_text);
Bundle bundle = new Bundle();
bundle.putString("message", message);
GoogleAnalyticsTracker.getInstance().trackEvent(
"Device", // Category
"Added", // Action
"", // Label
1);
PreyConfig.getPreyConfig(WelcomeBatchActivity.this).setCamouflageSet(true);
Intent intent = new Intent(WelcomeBatchActivity.this, PermissionInformationBatchActivity.class);
intent.putExtras(bundle);
Expand Down
12 changes: 6 additions & 6 deletions src/com/prey/analytics/GoogleAnalyticsSessionManager.java
Expand Up @@ -9,7 +9,7 @@
import android.app.Application;
import android.content.Context;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;

import com.prey.FileConfigReader;

public class GoogleAnalyticsSessionManager {
Expand Down Expand Up @@ -43,12 +43,12 @@ protected GoogleAnalyticsSessionManager( String apiKey, int dispatchIntervalSecs
* unusual you should synchronize them yourself.
*/
public void incrementActivityCount() {
if( activityCount==0 )
if( dispatchIntervalSecs==null )
/* if( activityCount==0 )
if( dispatchIntervalSecs==null )
GoogleAnalyticsTracker.getInstance().startNewSession(apiKey,context);
else
GoogleAnalyticsTracker.getInstance().startNewSession(apiKey,dispatchIntervalSecs,context);

*/
++activityCount;
}

Expand All @@ -61,8 +61,8 @@ public void incrementActivityCount() {
public void decrementActivityCount() {
activityCount = Math.max(activityCount-1, 0);

if( activityCount==0 )
GoogleAnalyticsTracker.getInstance().stopSession();
// if( activityCount==0 )
// GoogleAnalyticsTracker.getInstance().stopSession();
}


Expand Down
10 changes: 0 additions & 10 deletions src/com/prey/net/PreyWebServices.java
Expand Up @@ -39,7 +39,6 @@
import android.os.Build;
import android.telephony.TelephonyManager;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;
import com.prey.FileConfigReader;
import com.prey.PreyAccountData;
import com.prey.PreyConfig;
Expand All @@ -49,7 +48,6 @@
import com.prey.PreyPhone.Wifi;
import com.prey.actions.HttpDataService;
import com.prey.actions.observer.ActionsController;
import com.prey.analytics.PreyGoogleAnalytics;
import com.prey.backwardcompatibility.AboveCupcakeSupport;
import com.prey.events.Event;
import com.prey.exceptions.NoMoreDevicesAllowedException;
Expand Down Expand Up @@ -305,12 +303,6 @@ public String sendPreyHttpReport(Context ctx, ArrayList<HttpDataService> dataToS
httpResponse = PreyRestHttpClient.getInstance(ctx).post(url, parameters, preyConfig,entityFiles);
response=httpResponse.getResponseAsString();
PreyLogger.i("Report sent:["+httpResponse.getStatusLine()+"]" + response);
try{
GoogleAnalyticsTracker.getInstance().trackEvent("Report","Sent", "", 1);
}catch(NullPointerException ex){
GoogleAnalyticsTracker.getInstance().startNewSession(FileConfigReader.getInstance(ctx).getAnalyticsUA(),ctx);
GoogleAnalyticsTracker.getInstance().trackEvent("Report","Sent", "", 1);
}
if (preyConfig.isShouldNotify()) {
this.notifyUser(ctx);
}
Expand Down Expand Up @@ -705,7 +697,6 @@ public PreyHttpResponse sendPreyHttpData(Context ctx, ArrayList<HttpDataService>
else
preyHttpResponse = PreyRestHttpClient.getInstance(ctx).postAutentication(url, parameters, preyConfig,entityFiles);
//PreyLogger.d("Data sent_: " + preyHttpResponse.getResponseAsString());
PreyGoogleAnalytics.getInstance().trackAsynchronously(ctx,"Data/Sent");
if (preyConfig.isShouldNotify()) {
this.notifyUser(ctx);
}
Expand Down Expand Up @@ -835,7 +826,6 @@ public PreyHttpResponse sendPreyHttpReport(Context ctx, List<HttpDataService> da
else
preyHttpResponse = PreyRestHttpClient.getInstance(ctx).postAutentication(url, parameters, preyConfig,entityFiles);
PreyLogger.i("Report sent: " + preyHttpResponse.getResponseAsString());
PreyGoogleAnalytics.getInstance().trackAsynchronously(ctx,"Report/Sent");
if (preyConfig.isShouldNotify()) {
this.notifyUser(ctx);
}
Expand Down

0 comments on commit b4d9aaf

Please sign in to comment.