Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting connection timeout #85

Closed
indywidualny opened this issue Feb 2, 2016 · 3 comments
Closed

Setting connection timeout #85

indywidualny opened this issue Feb 2, 2016 · 3 comments

Comments

@indywidualny
Copy link

I'm trying to change connection timeout from 5 to 10 seconds. My server is not very stable at the moment. I tried mPiwikTracker.getDispatcher().setTimeOut(10000); in try block below but getDispatcher() has protected access. My first question - why? And the second: how do it properly?

I post some code from the class extending Application class to make it easier. This is how I get the tracker.

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.setDispatchInterval(-1);
        } catch (MalformedURLException e) {
            Log.w("Piwik", "url is malformed", e);
            return null;
        }

        return mPiwikTracker;
    }

And a piece from onCreate

getTracker().trackAppDownload();
getTracker().dispatch();
@d4rken
Copy link
Member

d4rken commented Feb 2, 2016

Hm yeah that is a problem.
The dispatcher is internal functionality, basically the Tracker is missing a setter for the timeout value.

I'll add a public method on the dev branch.

@d4rken
Copy link
Member

d4rken commented Feb 2, 2016

The dev branch now contains setters. You can build a jar from the dev branch (see docs).
The next release will likely be when #83 is done.

@d4rken d4rken closed this as completed Feb 2, 2016
@indywidualny
Copy link
Author

mPiwikTracker.setDispatchTimeout(30000); works great. Thanks!

@d4rken d4rken mentioned this issue May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants