# Piwik Android Integration

**URL:** <https://community.piwik.pro/t/piwik-android-integration/2610>\
**Category:** Data collection and tags\
**Created:** [July 18, 2023, 12:44pm UTC](https://community.piwik.pro/t/piwik-android-integration/2610 "2023-07-18T12:44:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sid](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sid](https://community.piwik.pro/u/Sid)\
**Post date:** [July 18, 2023, 12:44pm UTC](https://community.piwik.pro/t/piwik-android-integration/2610/1 "2023-07-18T12:44:04Z")

</div>

Integrated SDK in android app:

```auto
    public synchronized Tracker getPiwikTracker() {
        if (piwikTracker == null) {
            piwikTracker = Piwik.getInstance(getApplication()).newTracker(new TrackerConfig("https://vbi.containers.piwik.pro", MY_TRACKING_ID, "Default Tracker"));
        }
        return piwikTracker;
    }

    private void initPiwik() {
        Timber.plant(new Timber.DebugTree());
        TrackHelper.track().screen("sample").title("Title").with(getPiwikTracker());
    }

```

Calling `initPiwik()` results in following log messages:

```auto
07-18 17:16:54.191 27084 27156 D PIWIK:EventDiskCache: Cache check took 0ms
07-18 17:16:54.194 27084 27156 D PIWIK:EventDiskCache: Uncaching of 0 events took 1ms
07-18 17:16:54.194 27084 27156 D PIWIK:EventCache: Switched state to ONLINE, uncached 0 events from disk.
07-18 17:16:54.201 27084 27156 D PIWIK:Dispatcher: Drained 1 total events.
07-18 17:16:54.201 27084 27156 D PIWIK:Dispatcher: Drained 1 analytics events.
07-18 17:16:54.202 27084 27156 D PIWIK:Dispatcher: Drained 0 data manager events.
07-18 17:16:54.858 27084 27156 D PIWIK:Dispatcher: status code 404
07-18 17:16:54.862 27084 27156 D PIWIK:Dispatcher: Unsuccessful assuming OFFLINE, requeuing events.
07-18 17:16:54.865 27084 27156 D PIWIK:Dispatcher: Dispatched 0 analytics events.
07-18 17:16:54.866 27084 27156 D PIWIK:Dispatcher: Dispatched 0 audience manager events.

```

and

```auto
07-18 17:16:28.223 27084 27099 D StrictMode: StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
07-18 17:16:28.223 27084 27099 D StrictMode: at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1987)
07-18 17:16:28.223 27084 27099 D StrictMode: at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:336)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.util.zip.Inflater.finalize(Inflater.java:407)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:319)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:306)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.lang.Daemons$Daemon.run(Daemons.java:140)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.lang.Thread.run(Thread.java:1012)
07-18 17:16:28.223 27084 27099 D StrictMode: Caused by: java.lang.Throwable: Explicit termination method 'end' not called
07-18 17:16:28.223 27084 27099 D StrictMode: at dalvik.system.CloseGuard.openWithCallSite(CloseGuard.java:288)
07-18 17:16:28.223 27084 27099 D StrictMode: at dalvik.system.CloseGuard.open(CloseGuard.java:257)
07-18 17:16:28.223 27084 27099 D StrictMode: at java.util.zip.Inflater.<init>(Inflater.java:122)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.okio.GzipSource.<init>(GzipSource.java:64)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.http.HttpEngine.unzip(HttpEngine.java:484)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:661)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:475)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
07-18 17:16:28.223 27084 27099 D StrictMode: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:30)
07-18 17:16:28.223 27084 27099 D StrictMode: at pro.piwik.sdk.dispatcher.Dispatcher.dispatch(Dispatcher.java:273)
07-18 17:16:28.223 27084 27099 D StrictMode: at pro.piwik.sdk.dispatcher.Dispatcher$1.run(Dispatcher.java:190)
```

---

<div class="post-metadata">

**Author:** ![sararekowska](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/sararekowska/32/1582_2.png) [@sararekowska](https://community.piwik.pro/u/sararekowska)\
**Post date:** [July 18, 2023, 2:45pm UTC](https://community.piwik.pro/t/piwik-android-integration/2610/2 "2023-07-18T14:45:17Z")

</div>

Hi, welcome to the community!

One remark regarding the code you provided, in this part:

```auto
new TrackerConfig("https://vbi.containers.piwik.pro", MY_TRACKING_ID, "Default Tracker")

```

The first argument should be the server address, and in this case, you don’t need the “containers” part of the URL.

Also, are you using the newest version of our SDK (1.1.13)?

Let me know if the issue persists after removing “containers” from the address 🙂
