Add GA
This commit is contained in:
parent
a27c18b468
commit
13d896583f
@ -72,7 +72,8 @@ dependencies {
|
||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||
implementation 'org.apache.commons:commons-collections4:4.0'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
|
||||
// spinner loaders library
|
||||
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
|
||||
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
|
||||
implementation 'com.google.firebase:firebase-core:16.0.6'
|
||||
}
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
@ -19,12 +19,24 @@ import org.acra.sender.HttpSender;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.android.gms.analytics.GoogleAnalytics;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
|
||||
@AcraNotification(resText = R.string.notification_text,
|
||||
resTitle = R.string.notification_title,
|
||||
resChannelName = R.string.notification_channel)
|
||||
@AcraLimiter(failedReportLimit = 2)
|
||||
public class FindMyTutor extends Application {
|
||||
private static GoogleAnalytics sAnalytics;
|
||||
private static Tracker sTracker;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
sAnalytics = GoogleAnalytics.getInstance(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
@ -76,4 +88,17 @@ public class FindMyTutor extends Application {
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
/**
|
||||
* Gets the default {@link Tracker} for this {@link Application}.
|
||||
* @return tracker
|
||||
*/
|
||||
synchronized public Tracker getDefaultTracker() {
|
||||
// To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
|
||||
if (sTracker == null) {
|
||||
sTracker = sAnalytics.newTracker(R.xml.global_tracker);
|
||||
}
|
||||
|
||||
return sTracker;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.uam.wmi.findmytutor.FindMyTutor;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
|
||||
import com.uam.wmi.findmytutor.utils.ActiveFragment;
|
||||
@ -99,6 +101,10 @@ public abstract class BaseActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getContentViewId());
|
||||
|
||||
//Google Analytics
|
||||
FindMyTutor application = (FindMyTutor) getApplication();
|
||||
Tracker mTracker = application.getDefaultTracker();
|
||||
|
||||
drawerNavigationView = findViewById(R.id.nav_view);
|
||||
sideDrawer = findViewById(R.id.activity_container);
|
||||
feedbackUtils = new FeedbackUtils(BaseActivity.this);
|
||||
|
@ -33,9 +33,11 @@ import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.github.ybq.android.spinkit.SpinKitView;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.mapbox.geojson.Point;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.uam.wmi.findmytutor.FindMyTutor;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.BlackListAdapter;
|
||||
import com.uam.wmi.findmytutor.model.IsUsingListBool;
|
||||
@ -109,6 +111,9 @@ public class BlackList extends AppCompatActivity {
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
setContentView(R.layout.activity_black_list);
|
||||
ButterKnife.bind(this);
|
||||
//Google Analytics
|
||||
FindMyTutor application = (FindMyTutor) getApplication();
|
||||
Tracker mTracker = application.getDefaultTracker();
|
||||
|
||||
tutorId = PrefUtils.getUserId(getApplicationContext());
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
|
@ -19,7 +19,9 @@ import android.widget.EditText;
|
||||
|
||||
import com.auth0.android.jwt.Claim;
|
||||
import com.auth0.android.jwt.JWT;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.FindMyTutor;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.model.JwtToken;
|
||||
import com.uam.wmi.findmytutor.model.LdapUser;
|
||||
@ -61,6 +63,9 @@ LoginActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
//Google Analytics
|
||||
FindMyTutor application = (FindMyTutor) getApplication();
|
||||
Tracker mTracker = application.getDefaultTracker();
|
||||
mLoginNameView = findViewById(R.id.email);
|
||||
|
||||
ldapService = ApiClient.getClient(getApplicationContext())
|
||||
|
@ -15,6 +15,8 @@ import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.uam.wmi.findmytutor.FindMyTutor;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.utils.LocaleHelper;
|
||||
import com.uam.wmi.findmytutor.utils.LocaleUtils;
|
||||
@ -33,7 +35,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//Google Analytics
|
||||
FindMyTutor application = (FindMyTutor) getApplication();
|
||||
Tracker mTracker = application.getDefaultTracker();
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPreferenceFragment()).commit();
|
||||
}
|
||||
|
||||
|
@ -160,6 +160,8 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//Google Analytics
|
||||
|
||||
addPreferencesFromResource(R.xml.pref_sharing);
|
||||
locationSharing = (SwitchPreference) findPreference("key_sharing_enabled");
|
||||
statusSwitch = (SwitchPreference) findPreference("key_status_enabled");
|
||||
|
4
app/src/main/res/xml/global_tracker.xml
Normal file
4
app/src/main/res/xml/global_tracker.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="ga_trackingId" translatable="false">UA-132330555-1</string>
|
||||
</resources>
|
@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
Loading…
Reference in New Issue
Block a user