Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

SDK 4.10.0: java.lang.IllegalStateException: Timer was canceled #32

Open
gsams04 opened this issue Apr 21, 2017 · 1 comment
Open

SDK 4.10.0: java.lang.IllegalStateException: Timer was canceled #32

gsams04 opened this issue Apr 21, 2017 · 1 comment

Comments

@gsams04
Copy link

gsams04 commented Apr 21, 2017

Hi,

We recently upgraded to 4.10.0 from 4.4.0 and we've received multiple reports of this crash

java.lang.IllegalStateException: Timer was canceled
	at java.util.Timer.scheduleImpl(Timer.java:558)
	at java.util.Timer.schedule(Timer.java:456)
	at com.tune.location.TuneLocationListener$GetLocationUpdates.run(TuneLocationListener.java:249)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:211)
	at android.app.ActivityThread.main(ActivityThread.java:5317)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

We haven't personally seen this issue but this happens in all OS versions starting Lollipop.

If it's of any help, here's how we initialize Tune.

Tune.init(app,tune_advertiser_id,tune_converion_key );
Tune.getInstance().setShouldAutoCollectDeviceLocation(false);

What could've possibly been the problem?

Thanks for the help.

@gsams04 gsams04 changed the title SDK 4.10.0 SDK 4.10.0: java.lang.IllegalStateException: Timer was canceled Apr 21, 2017
@john-gu
Copy link

john-gu commented Apr 21, 2017

Hi @gsams04, it looks like a timing issue when the timer is canceled by setShouldAutoCollectDeviceLocation soon after init.

A better way to disabling location collection is to use the TuneConfiguration option in init:

TuneConfiguration tuneConfig = new TuneConfiguration();
tuneConfig.setShouldAutoCollectDeviceLocation(false);

Tune.init(this, "your_advertiser_id", "your_conversion_key", false, tuneConfig);

I will create a ticket to make setShouldAutoCollectDeviceLocation more thread-safe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants