@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.exit) {
      // close the Activity
      this.finish();
      return true;
    } else if (item.getItemId() == R.id.facebook) {
      facebook.authorize(
          this,
          new String[] {
            "user_checkins",
            "friends_checkins",
            "publish_checkins",
            "email",
            "publish_stream",
            "read_stream",
            "offline_access"
          },
          new DialogListener() {
            @Override
            public void onComplete(Bundle values) {
              Log.i("accesstoken =", "" + facebook.getAccessToken());
            }

            @Override
            public void onFacebookError(FacebookError error) {}

            @Override
            public void onError(DialogError e) {}

            @Override
            public void onCancel() {}
          });
      return true;
    } else if (item.getItemId() == R.id.note) {
      tracker.trackPageView("/Notes");

      Intent intent = new Intent(MainActivity.this, NotesList.class);
      startActivity(intent);
      return true;
    } else if (item.getItemId() == R.id.photo) {
      tracker.trackPageView("/Photos");

      Intent intent = new Intent(MainActivity.this, PhotoActivity.class);
      startActivity(intent);
      return true;
    } else if (item.getItemId() == R.id.voice) {
      tracker.trackPageView("/Voices");
      Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
      startActivityForResult(intent, RQS_RECORDING);
    }
    return false;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main2);

    int num = getIntent().getExtras().getInt("num");

    TextView tv = (TextView) findViewById(R.id.textView);

    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start("UA-24434459-1", 5, this);

    // セッション
    //        tracker.setCustomVar(2, "SecondActivity", "During Visit",3);
    // ページビュー
    tracker.trackPageView("/SecondAcivity");

    if (num == 1) {
      tv.setText("海が荒ぶる");
    } else if (num == 2) {
      tv.setText("魔法少女の特急便");
    } else {
      tv.setText("ゲド電気");
    }
  }
  @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();
    // }
  }
Exemple #4
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);
 }
 public void trackStats(Context context, String page, int stat, int statType, int sort) {
   if ((m_tracker != null) && m_bActive) {
     m_tracker.trackPageView(
         page
             + StatsProvider.getInstance(context).statToUrl(stat)
             + StatsProvider.getInstance(context).statTypeToUrl(statType)
             + "Sort"
             + sort);
   }
 }
  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();
    }
  }
 public void trackPage(String page) {
   if ((m_tracker != null) && m_bActive) {
     m_tracker.trackPageView(page);
   }
 }
Exemple #8
0
 @Override
 protected void onResume() {
   super.onResume();
   tracker.trackPageView("/friends");
 }
Exemple #9
0
 public void trackPageView(String pageView) {
   if (!ContextUtils.isStableBuild(ctx)) {
     return;
   }
   gat.trackPageView(pageView);
 }