downloadTracker.trackNewAppDownload(new TrackMe(), new DownloadTracker.Extra.ApkChecksum(mContext)); TestHelper.sleep(100); // APK checksum happens off thread verify(mTracker).track(mCaptor.capture());
downloadTracker.trackNewAppDownload(new TrackMe(), new DownloadTracker.Extra.ApkChecksum(mContext)); TestHelper.sleep(100); // APK checksum happens off thread verify(mTracker).track(mCaptor.capture());
private void onInitTracker() { // Print debug output when working on an app. Timber.plant(new Timber.DebugTree()); // When working on an app we don't want to skew tracking results. // getMatomo().setDryRun(BuildConfig.DEBUG); // If you want to set a specific userID other than the random UUID token, do it NOW to ensure all future actions use that token. // Changing it later will track new events as belonging to a different user. // String userEmail = ....preferences....getString // getTracker().setUserId(userEmail); // Track this app install, this will only trigger once per app version. // i.e. "http://org.matomo.demo:1/185DECB5CFE28FDB2F45887022D668B4" TrackHelper.track().download().identifier(new DownloadTracker.Extra.ApkChecksum(this)).with(getTracker()); // Alternative: // i.e. "http://org.matomo.demo:1/com.android.vending" // getTracker().download(); mDimensionQueue = new DimensionQueue(getTracker()); // This will be send the next time something is tracked. mDimensionQueue.add(0, "test"); getTracker().addTrackingCallback(trackMe -> { Timber.i("Tracker.Callback.onTrack(%s)", trackMe); return trackMe; }); } }
private void onInitTracker() { // Print debug output when working on an app. Timber.plant(new Timber.DebugTree()); // When working on an app we don't want to skew tracking results. // getMatomo().setDryRun(BuildConfig.DEBUG); // If you want to set a specific userID other than the random UUID token, do it NOW to ensure all future actions use that token. // Changing it later will track new events as belonging to a different user. // String userEmail = ....preferences....getString // getTracker().setUserId(userEmail); // Track this app install, this will only trigger once per app version. // i.e. "http://org.matomo.demo:1/185DECB5CFE28FDB2F45887022D668B4" TrackHelper.track().download().identifier(new DownloadTracker.Extra.ApkChecksum(this)).with(getTracker()); // Alternative: // i.e. "http://org.matomo.demo:1/com.android.vending" // getTracker().download(); mDimensionQueue = new DimensionQueue(getTracker()); // This will be send the next time something is tracked. mDimensionQueue.add(0, "test"); getTracker().addTrackingCallback(trackMe -> { Timber.i("Tracker.Callback.onTrack(%s)", trackMe); return trackMe; }); } }
@Test public void testDownloadTrackChecksum() throws Exception { DownloadTracker downloadTracker = mock(DownloadTracker.class); track().download(downloadTracker).identifier(new DownloadTracker.Extra.ApkChecksum(mContext)).with(mTracker); verify(downloadTracker).trackOnce(any(TrackMe.class), any(DownloadTracker.Extra.ApkChecksum.class)); }
@Test public void testDownloadTrackChecksum() throws Exception { DownloadTracker downloadTracker = mock(DownloadTracker.class); track().download(downloadTracker).identifier(new DownloadTracker.Extra.ApkChecksum(mContext)).with(mTracker); verify(downloadTracker).trackOnce(any(TrackMe.class), any(DownloadTracker.Extra.ApkChecksum.class)); }