• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tracker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.piwik.sdk.Tracker的典型用法代码示例。如果您正苦于以下问题:Java Tracker类的具体用法?Java Tracker怎么用?Java Tracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tracker类属于org.piwik.sdk包,在下文中一共展示了Tracker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * Get Piwik tracker. No sensitive data is collected. Just app version, predicted location,
 * resolution, device model and system version. Location is based on anonymized IP address.
 * @return tracker instance
 */
public synchronized Tracker getTracker() {
    if (mPiwikTracker != null)
        return mPiwikTracker;

    try {
        mPiwikTracker = Piwik.getInstance(this).newTracker("http://indywidualni.org/analytics/piwik.php", 1);
        mPiwikTracker.setUserId(Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));
        mPiwikTracker.setDispatchTimeout(30000);
        mPiwikTracker.setDispatchInterval(-1);
    } catch (MalformedURLException e) {
        Log.w("Piwik", "url is malformed", e);
        return null;
    }

    return mPiwikTracker;
}
 
开发者ID:indywidualny,项目名称:FaceSlim,代码行数:22,代码来源:MyApplication.java


示例2: EventDiskCache

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public EventDiskCache(Tracker tracker) {
    mMaxAge = tracker.getOfflineCacheAge();
    mMaxSize = tracker.getOfflineCacheSize();
    File baseDir = new File(tracker.getPiwik().getContext().getCacheDir(), CACHE_DIR_NAME);
    mCacheDir = new File(baseDir, tracker.getAPIUrl().getHost());
    File[] storedContainers = mCacheDir.listFiles();
    if (storedContainers != null) {
        Arrays.sort(storedContainers);
        for (File container : storedContainers) {
            mCurrentSize += container.length();
            mEventContainer.add(container);
        }
    } else {
        if (!mCacheDir.mkdirs()) Timber.tag(TAG).e("Failed to make disk-cache dir %s", mCacheDir);
    }
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:17,代码来源:EventDiskCache.java


示例3: onSharedPreferenceChanged

import org.piwik.sdk.Tracker; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences settings, String key) {
    if(key.equals(KEY_PREF_PARTICIPATE_STATISTICS)) {
        Tracker tracker = getTracker();
        tracker.setOptOut(!settings.getBoolean(KEY_PREF_PARTICIPATE_STATISTICS, true));
        this.initSentry();
        Log.i(TAG, "Piwik/Sentry OptOut status changed to: "+tracker.isOptOut());
    }
}
 
开发者ID:HackMyChurch,项目名称:aelf-dailyreadings,代码行数:10,代码来源:LecturesApplication.java


示例4: initPiwik

import org.piwik.sdk.Tracker; //导入依赖的package包/类
private void initPiwik() {
    // Track this app install, this will only trigger once per app version.
    Tracker tracker = getTracker();
    TrackHelper.track().download().identifier(new DownloadTracker.Extra.ApkChecksum(this)).with(tracker);
    tracker.setOptOut(!settings.getBoolean(KEY_PREF_PARTICIPATE_STATISTICS, true));
    // tracker.setDispatchInterval(1);

    Log.i(TAG, "Piwik setup complete. OptOut status: "+tracker.isOptOut());
}
 
开发者ID:HackMyChurch,项目名称:aelf-dailyreadings,代码行数:10,代码来源:LecturesApplication.java


示例5: getPiwikTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * @return the piwik instance
 */
private Tracker getPiwikTracker() {
    if (mPiwikTracker == null) {
        try {
            mPiwikTracker = Piwik.getInstance(this).newTracker(new TrackerConfig("https://piwik.riot.im/", 1, "AndroidPiwikTracker"));
            // sends the tracking information each minute
            // the app might be killed in background
            mPiwikTracker.setDispatchInterval(30 * 1000);

            //
            TrackMe trackMe = mPiwikTracker.getDefaultTrackMe();

            visitVariables(trackMe, 1, "App Platform", "Android Platform");
            visitVariables(trackMe, 2, "App Version", SHORT_VERSION);
            visitVariables(trackMe, 4, "Chosen Language", getApplicationLocale().toString());

            if (null != Matrix.getInstance(this).getDefaultSession()) {
                MXSession session = Matrix.getInstance(this).getDefaultSession();

                visitVariables(trackMe, 7, "Homeserver URL", session.getHomeServerConfig().getHomeserverUri().toString());
                visitVariables(trackMe, 8, "Identity Server URL", session.getHomeServerConfig().getIdentityServerUri().toString());
            }
        } catch (Throwable t) {
            Log.e(LOG_TAG, "## getPiwikTracker() : newTracker failed " + t.getMessage());
        }
    }

    return mPiwikTracker;
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:32,代码来源:VectorApp.java


示例6: onNewScreen

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * A new activity has been resumed
 * @param activity the new activity
 */
private void onNewScreen(Activity activity) {
    if (PreferencesManager.trackWithPiwik(this)) {
        Tracker tracker = getPiwikTracker();
        if (null != tracker) {
            try {
                TrackHelper.Screen screen = TrackHelper.track().screen("/android/" +   Matrix.getApplicationName() + "/" + this.getString(R.string.flavor_description) + "/" + SHORT_VERSION + "/"+ activity.getClass().getName().replace(".", "/"));
                addCustomVariables(screen).with(tracker);
            } catch (Throwable t) {
                Log.e(LOG_TAG, "## onNewScreen() : failed " + t.getMessage());
            }
        }
    }
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:18,代码来源:VectorApp.java


示例7: onAppPause

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * The application is paused.
 */
private void onAppPause() {
    if (PreferencesManager.trackWithPiwik(this)) {
        Tracker tracker = getPiwikTracker();
        if (null != tracker) {
            try {
                // force to send the pending actions
                tracker.dispatch();
            } catch (Throwable t) {
                Log.e(LOG_TAG, "## onAppPause() : failed " + t.getMessage());
            }
        }
    }
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:17,代码来源:VectorApp.java


示例8: build

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public Dispatcher build(Tracker tracker) {
    return new DefaultDispatcher(
            new EventCache(new EventDiskCache(tracker)),
            new Connectivity(tracker.getPiwik().getContext()),
            new PacketFactory(tracker.getAPIUrl()),
            new DefaultPacketSender()
    );
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:9,代码来源:DefaultDispatcherFactory.java


示例9: safelyWith

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * {@link #build()} can throw an exception on illegal arguments.
 * This can be used to avoid crashes when using dynamic {@link TrackMe} arguments.
 *
 * @return false if an error occured, true if the TrackMe has been submitted to be dispatched.
 */
public boolean safelyWith(Tracker tracker) {
    try {
        TrackMe trackMe = build();
        tracker.track(trackMe);
    } catch (IllegalArgumentException e) {
        Timber.e(e);
        return false;
    }
    return true;
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:17,代码来源:TrackHelper.java


示例10: with

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * @param tracker the tracker that should receive the exception events.
 * @return returns the new (but already active) exception handler.
 */
public Thread.UncaughtExceptionHandler with(Tracker tracker) {
    if (Thread.getDefaultUncaughtExceptionHandler() instanceof PiwikExceptionHandler) {
        throw new RuntimeException("Trying to wrap an existing PiwikExceptionHandler.");
    }
    Thread.UncaughtExceptionHandler handler = new PiwikExceptionHandler(tracker, mBaseBuilder.mBaseTrackMe);
    Thread.setDefaultUncaughtExceptionHandler(handler);
    return handler;
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:13,代码来源:TrackHelper.java


示例11: DownloadTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public DownloadTracker(Tracker tracker, @NonNull PackageInfo packageInfo) {
    mTracker = tracker;
    mContext = tracker.getPiwik().getContext();
    mPreferences = tracker.getPreferences();
    mPackMan = tracker.getPiwik().getContext().getPackageManager();
    mPkgInfo = packageInfo;
    mInternalTracking = mPkgInfo.packageName.equals(mContext.getPackageName());
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:9,代码来源:DownloadTracker.java


示例12: testPiwikAutoBindActivities

import org.piwik.sdk.Tracker; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Test
public void testPiwikAutoBindActivities() throws Exception {
    Application app = Robolectric.application;
    Tracker tracker = createTracker();
    tracker.setDryRunTarget(Collections.synchronizedList(new ArrayList<>()));
    //auto attach tracking screen view
    TrackHelper.track().screens(app).with(tracker);

    // emulate default trackScreenView
    Robolectric.buildActivity(TestActivity.class).create().start().resume().visible().get();

    assertEquals(TestActivity.getTestTitle(), new QueryHashMap(tracker.getLastEventX()).get(QueryParams.ACTION_NAME));
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:15,代码来源:PiwikApplicationTest.java


示例13: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
@Override
public Tracker getTracker() throws InvalidTrackerOperationException {
    return tracker;
}
 
开发者ID:federicoiosue,项目名称:analitica,代码行数:5,代码来源:PiwikAnalyticsHelper.java


示例14: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public static Tracker getTracker() {
	return tracker;
}
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:4,代码来源:AnalyticsHelper.java


示例15: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
private Tracker getTracker() {
    return ((TripleCamelApp) getApplication()).getTracker();
}
 
开发者ID:ebaschiera,项目名称:TripleCamel,代码行数:4,代码来源:MainActivity.java


示例16: PiwikExceptionHandler

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public PiwikExceptionHandler(@NonNull Tracker tracker, @Nullable TrackMe trackMe) {
    mTracker = tracker;
    mTrackMe = trackMe;
    mDefaultExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:6,代码来源:PiwikExceptionHandler.java


示例17: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public Tracker getTracker() {
    return mTracker;
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:4,代码来源:PiwikExceptionHandler.java


示例18: createTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
public Tracker createTracker() throws MalformedURLException {
    PiwikTestApplication app = (PiwikTestApplication) Robolectric.application;
    final Tracker tracker = Piwik.getInstance(Robolectric.application).newTracker(app.onCreateTrackerConfig());
    tracker.getPreferences().edit().clear().apply();
    return tracker;
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:7,代码来源:DefaultTestCase.java


示例19: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
private Tracker getTracker() {
    return ((PiwikApplication) getApplication()).getTracker();
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:4,代码来源:DemoActivity.java


示例20: getTracker

import org.piwik.sdk.Tracker; //导入依赖的package包/类
/**
 * Gives you an all purpose thread-safe persisted Tracker object.
 *
 * @return a shared Tracker
 */
public synchronized Tracker getTracker() {
    if (mPiwikTracker == null) mPiwikTracker = getPiwik().newTracker(onCreateTrackerConfig());
    return mPiwikTracker;
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:10,代码来源:PiwikApplication.java



注:本文中的org.piwik.sdk.Tracker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SerializableEntity类代码示例发布时间:2022-05-23
下一篇:
Java MarqueeToolEntry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap