本文整理汇总了Java中com.google.analytics.tracking.android.GAServiceManager类的典型用法代码示例。如果您正苦于以下问题:Java GAServiceManager类的具体用法?Java GAServiceManager怎么用?Java GAServiceManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GAServiceManager类属于com.google.analytics.tracking.android包,在下文中一共展示了GAServiceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTracker
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
private static Tracker getTracker(){
if(sTracker==null){
sTracker = GoogleAnalytics.getInstance(sInstance).getTracker(BuildConfig.GoogleAnalytics_KEY);
ExceptionReporter handler = new ExceptionReporter(
sTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(),
sInstance); // Current default uncaught exception handler.
// Make handler the new default uncaught exception handler for main(GUI) thread.
Thread.setDefaultUncaughtExceptionHandler(handler);
}
return sTracker;
}
示例2: setupUncaughtExceptionHandler
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
/**
* Report uncaught exceptions (crashes) to Analytics
*/
private void setupUncaughtExceptionHandler() {
ExceptionReporter myHandler = new ExceptionReporter(EasyTracker.getInstance(this),
GAServiceManager.getInstance(), Thread.getDefaultUncaughtExceptionHandler(), this);
StandardExceptionParser exceptionParser =
new StandardExceptionParser(getApplicationContext(), null) {
@Override
public String getDescription(String threadName, Throwable t) {
return "{" + threadName + "} " + "{" + Build.MODEL + "} " + "{" + Build.VERSION.SDK_INT + "} " + Log.getStackTraceString(t);
}
};
myHandler.setExceptionParser(exceptionParser);
Thread.setDefaultUncaughtExceptionHandler(myHandler);
}
示例3: TrackerInst
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
public TrackerInst() {
try {
EasyTracker.getInstance().setContext(MyApplication.self);
tracker = EasyTracker.getTracker();
// Use custom exception reporter to avoid but in GA v2.0 beta 4
exceptionReporter = new ExceptionReporter(
tracker,
GAServiceManager.getInstance(),
Thread.getDefaultUncaughtExceptionHandler(),
MyApplication.self
);
exceptionReporter.setExceptionParser(new MyExceptionParser());
Thread.setDefaultUncaughtExceptionHandler(exceptionReporter);
} catch (Exception ex) {
Common.log(ex);
tracker = null;
}
}
示例4: onCreate
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mGoogleAnalytics = GoogleAnalytics.getInstance(this);
mGaTracker = mGoogleAnalytics.getTracker(getString(R.string.ga_trackingId));
mGoogleAnalytics.setAppOptOut(mPreferences.getBoolean("analytics", false));
Thread.UncaughtExceptionHandler myHandler = new ExceptionReporter(
mGaTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(), this); // Current default uncaught exception handler.
// Make myHandler the new default uncaught exception handler.
Thread.setDefaultUncaughtExceptionHandler(myHandler);
// work-around for Android defect 9431
System.setProperty("java.net.preferIPv4Stack", "true");
System.setProperty("java.net.preferIPv6Addresses", "false");
System.setProperty("org.eclipse.jetty.util.UrlEncoded.charset", "utf-8");
}
示例5: startTracker
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void startTracker(String id, CallbackContext callbackContext) {
if (null != id && id.length() > 0) {
GoogleAnalytics.getInstance(this.cordova.getActivity()).getTracker(id);
callbackContext.success("tracker started");
trackerStarted = true;
GAServiceManager.getInstance().setLocalDispatchPeriod(30); //deprecated but whatcha gonna do? set dispatch period to 30 sec
// Set the log level to verbose.
/*GoogleAnalytics.getInstance(this.cordova.getActivity()).getLogger()
.setLogLevel(LogLevel.VERBOSE);*/
} else {
callbackContext.error("tracker id is not valid");
}
}
示例6: init
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Kroll.method
public void init( String trackingId, boolean dryRun, boolean manualSession, boolean async, int dispatch){
async_state = async;
if( async_state == false ){
GAServiceManager.getInstance().setLocalDispatchPeriod(dispatch);
}
mInstance.setDryRun(dryRun);
tracker = mInstance.getTracker(trackingId);
if( manualSession == true ){
tracker.set(Fields.SESSION_CONTROL, "start");
}
}
示例7: trackEvent
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Kroll.method
public void trackEvent(HashMap props){
KrollDict propsDict = new KrollDict(props);
String category = TiConvert.toString(propsDict, "category");
String action = TiConvert.toString(propsDict, "action");
String label = TiConvert.toString(propsDict, "label");
long value = TiConvert.toInt(propsDict, "value");
tracker.send(MapBuilder.createEvent(category, action, label, value).build());
if( async_state == true ){
GAServiceManager.getInstance().dispatchLocalHits();
}
}
示例8: trackScreen
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Kroll.method
public void trackScreen(String screen){
tracker.set(Fields.SCREEN_NAME, screen);
tracker.send(MapBuilder.createAppView().build());
if( async_state == true ){
GAServiceManager.getInstance().dispatchLocalHits();
}
}
示例9: onCreate
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Log.d(LOG_TAG, "onCreate()");
mWifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
mNetIf = Utils.getActiveNetworkInterface();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mPreferences = getSharedPreferences("cheapcast", MODE_PRIVATE | MODE_MULTI_PROCESS);
} else {
mPreferences = getSharedPreferences("cheapcast", MODE_PRIVATE);
}
Log.d(LOG_TAG, String.format("Starting up: friendlyName: %s", mPreferences.getString("friendly_name","CheapCasto")));
mGson = new Gson();
mGoogleAnalytics = GoogleAnalytics.getInstance(this);
mGaTracker = mGoogleAnalytics.getTracker(getString(R.string.ga_trackingId));
mGoogleAnalytics.setAppOptOut(mPreferences.getBoolean("analytics", false));
Thread.UncaughtExceptionHandler myHandler = new ExceptionReporter(
mGaTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(), this); // Current default uncaught exception handler.
mGaTracker.sendEvent("CheapCastService","ServiceStart", null,null);
mRegisteredApps = new HashMap<String, App>();
registerApp(new App("ChromeCast", "https://www.gstatic.com/cv/receiver.html?$query"));
registerApp(new App("YouTube", "https://www.youtube.com/tv?$query"));
registerApp(new App("PlayMovies", "https://play.google.com/video/avi/eureka?$query", new String[]{"play-movies", "ramp"}));
registerApp(new App("GoogleMusic", "https://play.google.com/music/cast/player"));
registerApp(new App("GoogleCastSampleApp", "http://anzymrcvr.appspot.com/receiver/anzymrcvr.html"));
registerApp(new App("GoogleCastPlayer", "https://www.gstatic.com/eureka/html/gcp.html"));
registerApp(new App("Fling", "$query"));
registerApp(new App("TicTacToe", "http://www.gstatic.com/eureka/sample/tictactoe/tictactoe.html", new String[]{"com.google.chromecast.demo.tictactoe"}));
}
示例10: initializeGa
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
/**
* Initialize Google Analytics tracker.
*/
private void initializeGa() {
mGa = GoogleAnalytics.getInstance(this);
mTracker = mGa.getTracker(GA_PROPERTY_ID);
// Set dispatch period.
GAServiceManager.getInstance().setLocalDispatchPeriod(GA_DISPATCH_PERIOD);
// Set Logger verbosity.
mGa.getLogger().setLogLevel(GA_LOG_VERBOSITY);
}
示例11: init
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
public static void init(Context ctx, int dispatchSeconds) {
// Start the tracker in manual dispatch mode...
// tracker.startNewSession("UA-YOUR-ACCOUNT-HERE", this);
// ...alternatively, the tracker can be started with a dispatch interval
// (in seconds).
GoogleAnalytics.getInstance(ctx);
EasyTracker.getInstance(ctx);
GAServiceManager.getInstance().setLocalDispatchPeriod(dispatchSeconds);
if (me == null) {
me = new AnalyticsGoogleV3();
Analytics.add(me);
}
}
示例12: track
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
@Override
public void track(String name) {
tracker.set(Fields.SCREEN_NAME, name);
Map<String, String> param = MapBuilder.createAppView()
.build();
tracker.send(param);
GAServiceManager.getInstance().dispatchLocalHits();
}
示例13: init
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
public static void init(Context ctx, int dispatchSeconds, String trackingId) {
Tracker tracker = GoogleAnalytics.getInstance(ctx).getTracker(
trackingId);
GAServiceManager.getInstance().setLocalDispatchPeriod(dispatchSeconds);
if (me == null) {
me = new AnalyticsGoogleTracker(tracker);
Analytics.add(me);
}
}
示例14: init
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
public static void init(Context ctx, int dispatchSeconds) {
// Start the tracker in manual dispatch mode...
// tracker.startNewSession("UA-YOUR-ACCOUNT-HERE", this);
// ...alternatively, the tracker can be started with a dispatch interval
// (in seconds).
EasyTracker.getInstance().setContext(ctx);
GAServiceManager.getInstance().setDispatchPeriod(dispatchSeconds);
if (me == null) {
me = new AnalyticsGoogleV2();
Analytics.add(me);
}
}
示例15: Analytics
import com.google.analytics.tracking.android.GAServiceManager; //导入依赖的package包/类
public Analytics(Context context) {
mGaInstance = GoogleAnalytics.getInstance(context);
//testes UA-38962564-1 pra valer UA-40266822-1
mGaTracker = mGaInstance.getTracker("UA-40266822-1");
GAServiceManager.getInstance().setDispatchPeriod(30);
String deviceId = ((TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
if (deviceId == null)
deviceId = "anonymous";
track("/user/" + deviceId);
}