本文整理汇总了Java中com.google.android.apps.analytics.GoogleAnalyticsTracker类的典型用法代码示例。如果您正苦于以下问题:Java GoogleAnalyticsTracker类的具体用法?Java GoogleAnalyticsTracker怎么用?Java GoogleAnalyticsTracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GoogleAnalyticsTracker类属于com.google.android.apps.analytics包,在下文中一共展示了GoogleAnalyticsTracker类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SpaceGameThread
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
public SpaceGameThread() {
super();
// Start in STATE_LOADING
SpaceGameState.getInstance().setState(SpaceGameState.STATE_LOADING);
// speed for flinging the screen
mViewport.setFlingSpeed(new Vector2(0, 0));
// rects
mViewportScratch = new Rect();
// rendering engine
mRenderer = new AndroidRenderer();
tracker = GoogleAnalyticsTracker.getInstance();
}
开发者ID:tschut,项目名称:drturbo,代码行数:18,代码来源:SpaceGameThread.java
示例2: onResume
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onResume() {
GoogleAnalyticsTracker.getInstance().trackPageView("/help");
PALManager.getLog().v(TAG, "onResume");
super.onResume();
SpaceView spaceView = (SpaceView) findViewById(R.id.space);
spaceView.ignoreInput(true);
GameThreadHolder.getThread().setSurfaceHolder(spaceView.getHolder());
GameThreadHolder.getThread().changeLevel(SpaceLevel.ID_HELP1, true);
GameThreadHolder.getThread().postSyncRunnable(new Runnable() {
public void run() {
GameThreadHolder.getThread().unfreeze();
}
});
}
开发者ID:tschut,项目名称:drturbo,代码行数:19,代码来源:HelpActivity.java
示例3: AnalyticsUtils
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
/**
* Our primary constructor.
*
* @param application
*/
@SuppressWarnings("deprecation")
private AnalyticsUtils(Application application) {
if (application == null) {
// This should only occur for the empty AnalyticsUtils object.
return;
}
_tracker = GoogleAnalyticsTracker.getInstance();
// Unfortunately this needs to be synchronous.
_tracker.start(_uaCode, NETWORK_TIMEOUT, application);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(application);
final boolean firstRun = prefs.getBoolean(FIRST_RUN_KEY, true);
if (firstRun) {
String apiLevel = Build.VERSION.SDK;
String model = Build.MODEL;
_tracker.setCustomVar(1, "apiLevel", apiLevel, VISITOR_SCOPE);
_tracker.setCustomVar(2, "model", model, VISITOR_SCOPE);
prefs.edit().putBoolean(FIRST_RUN_KEY, false).commit();
}
}
开发者ID:androidfu,项目名称:Library_GoogleAnalytics,代码行数:25,代码来源:AnalyticsUtils.java
示例4: sendPageViews
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
/**
* 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);
}
开发者ID:Plonk42,项目名称:mytracks,代码行数:15,代码来源:AnalyticsUtils.java
示例5: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
setContentView(R.layout.user_guide_layout);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(this.getResources().getString(R.string.urlEcho5BravoGuide));
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:36,代码来源:ActivityUserGuide.java
示例6: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:31,代码来源:ActivityPreferences.java
示例7: getXML
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
public static String getXML(URL url) throws IOException {
HttpURLConnection conn = null;
if (url.getProtocol().toLowerCase().equals("https")) {
trustAllHosts();
HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
https.setHostnameVerifier(DO_NOT_VERIFY);
conn = https;
} else {
conn = (HttpURLConnection) url.openConnection();
}
setUserAgent(conn);
conn.setRequestProperty("connection", "close");
conn.setRequestMethod("GET");
BufferedReader reader = null;
String output = null;
try {
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
output = toString(reader);
} finally {
if (reader != null) {
reader.close();
}
}
// Dispatch any queued Analytics data while we've got the network
// open
try {
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
if(tracker != null)
tracker.dispatch();
} catch (Exception e1) {
//ignore any exceptions thrown by analytics
}
return output;
}
开发者ID:lenworthrose,项目名称:music-app,代码行数:36,代码来源:UrlUtil.java
示例8: onResume
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onResume() {
PALManager.getLog().v(TAG, "onResume");
GoogleAnalyticsTracker.getInstance().trackPageView("/mainmenu");
super.onResume();
if (goToHelpImmediately()) {
GameThreadHolder.getThread().postSyncRunnable(new Runnable() {
public void run() {
GameThreadHolder.getThread().freeze();
}
});
Intent intent = new Intent(SpaceApp.mAppContext, HelpActivity.class);
startActivityForResult(intent, SpaceApp.ACTIVITY_HELP);
} else {
SpaceView spaceView = (SpaceView) findViewById(R.id.space);
spaceView.ignoreInput(true);
GameThreadHolder.getThread().setSurfaceHolder(spaceView.getHolder());
GameThreadHolder.getThread().changeLevel(SpaceLevel.ID_LOADING_SCREEN, true);
GameThreadHolder.getThread().postSyncRunnable(new Runnable() {
public void run() {
GameThreadHolder.getThread().unfreeze();
}
});
SpaceGameState.getInstance().setPaused(false);
}
}
开发者ID:tschut,项目名称:drturbo,代码行数:31,代码来源:MainMenu.java
示例9: AnalyticsUtils
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
private AnalyticsUtils(Context context) {
if (context == null) {
// This should only occur for the empty Analytics utils object.
return;
}
mApplicationContext = context.getApplicationContext();
mTracker = GoogleAnalyticsTracker.getInstance();
// Unfortunately this needs to be synchronous.
mTracker.start(UACODE, 300, mApplicationContext);
Log.d(TAG, "Initializing Analytics");
// Since visitor CV's should only be declared the first time an app
// runs, check if
// it's run before. Add as necessary.
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(mApplicationContext);
final boolean firstRun = prefs.getBoolean(FIRST_RUN_KEY, true);
if (firstRun) {
Log.d(TAG, "Analytics firstRun");
String apiLevel = Integer.toString(Build.VERSION.SDK_INT);
String model = Build.MODEL;
mTracker.setCustomVar(1, "apiLevel", apiLevel, VISITOR_SCOPE);
mTracker.setCustomVar(2, "model", model, VISITOR_SCOPE);
// Close out so we never run this block again, unless app is removed
// & =
// reinstalled.
prefs.edit().putBoolean(FIRST_RUN_KEY, false).commit();
}
}
开发者ID:devoxx,项目名称:mobile-client,代码行数:35,代码来源:AnalyticsUtils.java
示例10: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
/* Some initializations */
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
ListView listView = new ListView(this);
listView.setId(android.R.id.list);
listView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT, 1));
layout.addView(listView);
this.setContentView(layout);
/* Preferences time! (we build the preferences) */
Preference version = getPreference("GoVRE", "Version 2.0.1.0", null);
Preference author = getPreference("Author", "Jason Brannon - ECHO5BRAVO, LLC", null);
Preference marketLink = getPreference("Developer", "More about the GoVRE", new Intent(Intent.ACTION_VIEW, Uri.parse("http://echo5bravo.com")));
//DialogPreference license = new MyDialogPreference(this, "License", "Go To: http://www.google.com/GoVRE License");
Preference dedication = getPreference("Dedication", "This app is dedicated to my son, Blaine, who enjoys riding the VRE and always expresses his natural love for trains.", null);
Preference acknowledgment1 = getPreference("Acknowledgment", "Kevin Waite - All the way from Scotland, providing great insight, source and knowledge on SensorEvents and LocationProviders. \"Moran taing\"", new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.fishbox-tales.org.uk/")));
Preference acknowledgment2 = getPreference("Acknowledgment", "Scott Roth - Provided great feedback and quality assurance during the testing of version 2.x", null);
/* Now we add the preferences to the preference screen */
PreferenceScreen preferenceScreen = this.getPreferenceManager().createPreferenceScreen(this);
addPreferenceCategory(preferenceScreen, "Preferences Tutorial", version, author, marketLink, dedication, acknowledgment1, acknowledgment2);
this.setPreferenceScreen(preferenceScreen);
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:60,代码来源:ActivityAbout.java
示例11: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
this.setContentView(R.layout.alerts_layout);
txtAlerts = (TextView) findViewById(R.id.txtAlertMessage);
txtAlerts.setMovementMethod(new ScrollingMovementMethod());
txtE5BAlerts = (TextView) findViewById(R.id.txtE5BAlertMessage);
txtE5BAlerts.setMovementMethod(new ScrollingMovementMethod());
spinner = (ImageView) findViewById(R.id.splashSpinner);
spinnerAnim = (AnimationDrawable) spinner.getBackground();
spinner2 = (ImageView) findViewById(R.id.splashSpinner2);
spinnerAnim2 = (AnimationDrawable) spinner2.getBackground();
imgNoSignal = (ImageView) findViewById(R.id.imgNoSignal);
imgNoSignal2 = (ImageView) findViewById(R.id.imgNoSignal2);
context = this;
addListenerOnTwitterImage();
addListenerOnMapImage();
addListenerOnSchedImage();
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:49,代码来源:ActivityAlerts.java
示例12: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
this.setContentView(R.layout.twitter_layout);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
myListView = (ListView) findViewById(R.id.TwitterListView);
spinner = (ImageView) findViewById(R.id.splashSpinner);
spinnerAnim = (AnimationDrawable) spinner.getBackground();
imgNoSignal = (ImageView) findViewById(R.id.imgNoSignal);
context = this;
addListenerOnMapImage();
addListenerOnAlert();
addListenerOnSched();
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:43,代码来源:ActivityTwitterFeed.java
示例13: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
this.setContentView(R.layout.station_listview_layout);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 30, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
context = this;
Device.isDeviceOnline(this.getApplicationContext());
myListView = (ListView) findViewById(R.id.listView);
spinner = (ImageView) findViewById(R.id.splashSpinner);
spinner.setVisibility(View.INVISIBLE); //Added this to test Layout
spinnerAnim = (AnimationDrawable) spinner.getBackground();
// Get the location manager
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
/*
* Since getting the current provider's current location is costly, we're using
* the last known location to speed the load time of this activity. We'll set
* the current location onResume() so our ListView will populate 1st and get an
* update when the current location becomes available.
*/
try{
if(this.getBestLocationProvider() != null)
currentLocation = locationManager.getLastKnownLocation(this.getBestLocationProvider());
// Remember where we are. If the Device has or enabled WiFi/Service location tracking
if (currentLocation != null)
this.setCurrentLocation(savedInstanceState);
// Get the compass service to give our bearings.
//Log.d(TAG, "Connecting to the compass sensor");
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
}
catch(Exception ex)
{
ex.toString();
}
addListenerOnTwitterImage();
addListenerOnMapImage();
addListenerOnAlert();
addListenerOnSched();
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:76,代码来源:ActivityStationList.java
示例14: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
this.setContentView(R.layout.old_train_map_layout);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
spinner = (ImageView) findViewById(R.id.splashSpinner);
imgNoSignal = (ImageView) findViewById(R.id.imgNoSignal);
spinnerAnim = (AnimationDrawable) spinner.getBackground();
context = this;
addListenerOnTwitterImage();
addListenerOnMapImage();
addListenerOnAlert();
addListenerOnSched();
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:42,代码来源:ActivityOldMap.java
示例15: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_BlueMoon);
setContentView(R.layout.googlemap_v2_layout);
//Start Google Analytics Tracker
//-------------------------------------------------------------------------------------------------
googleTracker = GoogleAnalyticsTracker.getInstance();
googleTracker.setDebug(Boolean.parseBoolean(this.getString(R.bool.ga_debug)));
googleTracker.setDryRun(Boolean.parseBoolean(this.getString(R.bool.ga_dryrun)));
googleTracker.startNewSession(this.getString(R.string.ga_api_key), 60, this);
int CV_SLOT_1 = 1; //Slot 1 Tracks Device Orientation
//int CV_SLOT_2 = 2; //Slot 2 Unassigned
//int CV_SLOT_3 = 3; //Slot 3 Unassigned
//int CV_SLOT_4 = 4; //Slot 4 Unassigned
//int CV_SLOT_5 = 5; //Slot 5 Unassigned
//Track Device's Current Orientation
googleTracker.setCustomVar(CV_SLOT_1, //SLOT (Can only track up to 5)
"Device Orientation", //NAME
Device.getDeviceOrientation(this.getApplicationContext()), //VALUE
1); //SCOPE
/*-------------------------------------------------------------------------------------------------
NOTE: Add to Activity Handlers:
onResume(): googleTracker.trackPageView("/" + TAG);
onDestroy(): googleTracker.stopSession();
-------------------------------------------------------------------------------------------------*/
context = this;
spinner = (ImageView) findViewById(R.id.splashSpinner);
txtRefresh = (TextView) findViewById(R.id.txtrefresh);
txtArrivals = (TextView) findViewById(R.id.txtarrivals);
spinnerAnim = (AnimationDrawable) spinner.getBackground();
imgNoSignal = (ImageView) findViewById(R.id.imgNoSignal);
addListenerOnTwitterImage();
addListenerOnAlert();
addListenerOnSched();
setUpMapIfNeeded();
}
开发者ID:JasonBrannon,项目名称:GoVRE,代码行数:47,代码来源:ActivityGoogleMapV2.java
示例16: doPost
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
public static String doPost(URL url, InputStream stuffToPost, String contentType) throws IOException {
HttpURLConnection conn = null;
if (url.getProtocol().toLowerCase().equals("https")) {
trustAllHosts();
HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
https.setHostnameVerifier(DO_NOT_VERIFY);
conn = https;
} else {
conn = (HttpURLConnection) url.openConnection();
}
setUserAgent(conn);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("connection", "close");
if (contentType != null) {
conn.setRequestProperty("Content-Type", contentType);
}
OutputStream ostr = null;
try {
ostr = conn.getOutputStream();
copy(stuffToPost, ostr);
} finally {
if (ostr != null)
ostr.close();
}
BufferedReader reader = null;
String response = "";
conn.connect();
try {
if(conn.getInputStream() != null)
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()), 512);
} catch (IOException e) {
if(conn.getErrorStream() != null)
reader = new BufferedReader(new InputStreamReader(conn.getErrorStream()), 512);
}
if(reader != null) {
response = toString(reader);
reader.close();
}
// Dispatch any queued Analytics data while we've got the network
// open
try {
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
if(tracker != null)
tracker.dispatch();
} catch (Exception e1) {
//ignore any exceptions thrown by analytics
}
return response;
}
开发者ID:lenworthrose,项目名称:music-app,代码行数:55,代码来源:UrlUtil.java
示例17: onResume
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
GoogleAnalyticsTracker.getInstance().trackPageView("/levelselect");
}
开发者ID:tschut,项目名称:drturbo,代码行数:6,代码来源:LevelSelect.java
示例18: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize the PALManager stuff
PALManager.setResourceHandler(new AndroidResourceHandler());
PALManager.setBitmapFactory(new AndroidBitmapFactory());
if (DebugSettings.DEBUG_LOGGING) {
PALManager.setLog(new AndroidLog());
} else {
PALManager.setLog(new EmptyLog());
}
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
SpaceUtil.init(dm.xdpi, dm.ydpi);
Rect resolution = new Rect(0, 0, dm.widthPixels, dm.heightPixels);
SpaceUtil.setResolution(resolution);
SpaceApp.mAppContext = this;
PALManager.getLog().v(TAG, "onCreate");
GoogleAnalyticsTracker.getInstance().startNewSession("UA-34397887-2", 30, this);
// set the view
setContentView(R.layout.loading_layout);
SpaceData.getInstance().addLoadingDoneListener(this);
// start the game thread
final SpaceGameThread lThread = GameThreadHolder.createThread();
lThread.setRunning(true);
lThread.freeze();
if (lThread.getState() == Thread.State.NEW)
lThread.start();
lThread.postRunnable(new Runnable() {
public void run() {
SpaceData.getInstance().preloadAllLevels();
LevelDbAdapter.getInstance().insertAllLevelsIfEmpty();
// load the fist level
lThread.changeLevel(0, true);
SpaceData.getInstance().setLoadingDone();
}
});
}
开发者ID:tschut,项目名称:drturbo,代码行数:48,代码来源:LoadingActivity.java
示例19: onCreate
import com.google.android.apps.analytics.GoogleAnalyticsTracker; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
if (DEVELOPER_MODE) {
StrictMode.enableDefaults();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (!DEVELOPER_MODE) {
mTracker = GoogleAnalyticsTracker.getInstance();
mTracker.setProductVersion(getPlatformName(), getAppVersion(this));
mTracker.start(ANALYTICS_ACCOUNT_ID, ANALYTICS_REFRESH_INTERVAL_SECONDS, this);
}
trackPage("/app/create/" + getAppVersion(this));
Arrays.fill(mIsLayerLoaded, false);
mView = (BodyGLSurfaceView) findViewById(R.id.gl_view);
mView.initialize(this);
mView.setFocusableInTouchMode(true);
if (findViewById(R.id.btn_header_layer) != null) {
mBodyUi = new PhoneUi(this);
} else {
mBodyUi = new TabletUi(this);
}
// Performance cargo-culting.
getWindow().setBackgroundDrawable(null);
BodyTosDialog.show(this);
SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE);
manager.setOnDismissListener(new SearchManager.OnDismissListener() {
@Override
public void onDismiss() {
// Called both on cancel and confirm.
Log.d("Body", "search onDismiss");
assert mIsInSearch;
mIsInSearch = false;
}
});
// See http://developer.android.com/guide/topics/search/search-dialog.html,
// search for "singleTop".
handleIntent(getIntent());
}
开发者ID:frydsh,项目名称:GoogleBody,代码行数:49,代码来源:BodyActivity.java
注:本文中的com.google.android.apps.analytics.GoogleAnalyticsTracker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论