本文整理汇总了Java中com.google.android.apps.analytics.GoogleAnalyticsTracker.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleAnalyticsTracker.getInstance方法的具体用法?Java GoogleAnalyticsTracker.getInstance怎么用?Java GoogleAnalyticsTracker.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.apps.analytics.GoogleAnalyticsTracker
的用法示例。
在下文中一共展示了GoogleAnalyticsTracker.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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();
}
}
示例3: 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);
}
示例4: 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));
}
示例5: 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();
-------------------------------------------------------------------------------------------------*/
}
示例6: 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;
}
示例7: 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();
}
}
示例8: 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);
}
示例9: 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();
}
示例10: 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();
}
示例11: 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();
}
示例12: 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();
}
示例13: 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();
}
示例14: 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;
}
示例15: 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());
}