示例#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();
    // }
  }
示例#2
0
 /**
  * Sends a page view.
  *
  * @param context the context
  * @param page the page
  */
 public static void sendPageViews(Context context, String page) {
   if (tracker == null) {
     tracker = GoogleAnalyticsTracker.getInstance();
     tracker.startNewSession(UA, context);
     tracker.setProductVersion(PRODUCT_NAME, SystemUtils.getMyTracksVersion(context));
   }
   tracker.trackPageView(page);
 }
 // begin the tracker for an activity - should be called only once per activity instance
 public static GoogleAnalyticsTracker start(Activity activity) {
   if (analyticsEnabled(activity)) {
     Log.i(Utils.TAG, "[Analytics] Tracker starting");
     GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
     String code = activity.getResources().getString(R.string.google_analytics_tracking_code);
     tracker.startNewSession(code, activity);
     return tracker;
   } else return null;
 }
  public static GoogleAnalytics getInstance(Context context) {
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    m_bActive = sharedPrefs.getBoolean("use_analytics", true);

    if (m_singleton == null) {
      m_singleton = new GoogleAnalytics();
      if (m_bActive) {
        m_tracker = GoogleAnalyticsTracker.getInstance();

        // Start the tracker in manual dispatch mode...
        m_tracker.startNewSession("TRACKING_CODE_HERE", 20, context);
      }
    }
    return m_singleton;
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mContext = this;

    /** GA * */
    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.startNewSession("UA-34492615-1", 10, this);

    View banner = (View) this.findViewById(R.id.relaBanner);
    AdView adView = (AdView) banner.findViewById(R.id.adView);
    adView.loadAd(new AdRequest());

    layout = (LinearLayout) findViewById(R.id.linearContent);

    // Make my account as default
    vContent = new MyAccountView(this, mApi);
    ((MyAccountView) vContent).setOnItemSelectionListener(this);
    layout.addView(vContent);
  }
示例#6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getSupportFragmentManager().findFragmentById(android.R.id.content) != null) {
      FragmentManager fragMgr = getSupportFragmentManager();
      FragmentTransaction ft = fragMgr.beginTransaction();
      ft.detach(getSupportFragmentManager().findFragmentById(android.R.id.content));
      ft.commit();
    }

    tracker = GoogleAnalyticsTracker.getInstance();

    // Start the tracker in manual dispatch mode...
    tracker.startNewSession(Keys.ANALYTICS_KEY, this);
    // setup action bar for tabs
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    Tab friendsTab =
        actionBar
            .newTab()
            .setText(R.string.friends_tabtitle)
            .setTabListener(
                new TabListenerList<FriendListFragment>(this, "friends", FriendListFragment.class));
    actionBar.addTab(friendsTab, true);

    Tab groupsTab =
        actionBar
            .newTab()
            .setText(R.string.groups_tabtitle)
            .setTabListener(
                new TabListenerList<GroupListFragment>(this, "groups", GroupListFragment.class));
    actionBar.addTab(groupsTab, true);

    actionBar.setSelectedNavigationItem(0);
  }