Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fadein, R.anim.fadeout);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    setContentView(R.layout.main);
    View LLView = findViewById(R.id.LLMainPage);
    View root = LLView.getRootView();
    root.setBackgroundColor(Color.WHITE);

    Start = (Button) findViewById(R.id.btnStartPractice);
    // Version =(TextView)findViewById(R.id.txtMainpgVersion);
    Start.setOnClickListener(this);

    ConfigureVersion();
    tracker = GoogleAnalyticsTracker.getInstance();
    // Start the tracker in manual dispatch mode...
    tracker.startNewSession("UA-32911832-1", this);

    tracker.trackPageView("/ApplicationStart");
    tracker.dispatch();

    // testing the cache HERE
    // LocalCache cache = ((LocalCache)getApplicationContext());

    // List<QuestionLookupItem> items = cache.getQuestionsIds();

    // if(items != null){

    // Toast.makeText(getBaseContext(),
    //        "Your query returned " + String.valueOf(items.size()) + " records.",
    //        Toast.LENGTH_LONG).show();
    // }
  }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // init
    activity = this;
    res = this.getResources();
    app = (cgeoapplication) this.getApplication();
    settings = new cgSettings(this, getSharedPreferences(cgSettings.preferences, 0));
    base = new cgBase(app, settings, getSharedPreferences(cgSettings.preferences, 0));
    warning = new cgWarning(this);

    // set layout
    if (settings.skin == 1) {
      setTheme(R.style.light);
    } else {
      setTheme(R.style.dark);
    }
    setContentView(R.layout.waypoint);
    base.setTitle(activity, "waypoint");

    // google analytics
    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start(cgSettings.analytics, this);
    tracker.dispatch();
    base.sendAnal(activity, tracker, "/waypoint/detail");

    // get parameters
    Bundle extras = getIntent().getExtras();

    // try to get data from extras
    if (extras != null) {
      id = extras.getInt("waypoint");
      geocode = extras.getString("geocode");
    }

    if (id <= 0) {
      warning.showToast(res.getString(R.string.err_waypoint_unknown));
      finish();
      return;
    }

    if (geo == null) {
      geo = app.startGeo(activity, geoUpdate, base, settings, warning, 0, 0);
    }

    waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
    waitDialog.setCancelable(true);

    (new loadWaypoint()).start();
  }
Exemplo n.º 3
0
 public static void event(
     Activity activity,
     GoogleAnalyticsTracker tracker,
     String category,
     String action,
     String label) {
   if (tracker != null && analyticsEnabled(activity)) {
     tracker = attachCustomVars(activity, tracker);
     Log.i(
         Utils.TAG,
         "[Analytics] Tracking event - category: "
             + category
             + ", action: "
             + action
             + ", label: "
             + label);
     // tracker.setDebug(true);
     tracker.setAnonymizeIp(true);
     tracker.trackEvent(category, action, label, -1);
     tracker.dispatch();
   }
 }
Exemplo n.º 4
0
  public static void page(
      Activity activity, GoogleAnalyticsTracker tracker, String page, boolean checkEntry) {
    if (tracker != null && analyticsEnabled(activity)) {

      if (checkEntry) {
        String source = entrySource(activity);
        if (source != null) {
          Log.i(
              Utils.TAG,
              "[Analytics] Marking next page view as an entry to the app of type: " + source);

          markEntry(activity, tracker, source);
        }
      }

      tracker = attachCustomVars(activity, tracker);

      Log.i(Utils.TAG, "[Analytics] Tracking page - " + page);
      // tracker.setDebug(true);
      tracker.setAnonymizeIp(true);
      tracker.trackPageView(page);
      tracker.dispatch();
    }
  }
Exemplo n.º 5
0
  @Override
  protected void onPause() {
    super.onPause();

    tracker.dispatch();
  }
Exemplo n.º 6
0
 public static void dispatch() {
   if (tracker != null) {
     tracker.dispatch();
   }
 }
Exemplo n.º 7
0
 @Override
 public void onStop() {
   tracker.dispatch();
   super.onStop();
 }