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

Looper.prepare #4

Open
elidor86 opened this issue Apr 10, 2013 · 2 comments
Open

Looper.prepare #4

elidor86 opened this issue Apr 10, 2013 · 2 comments

Comments

@elidor86
Copy link

when starting a connection from android service i got this error :

04-10 13:28:47.954: E/AndroidRuntime(25438): FATAL EXCEPTION: Timer-0
04-10 13:28:47.954: E/AndroidRuntime(25438): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
04-10 13:28:47.954: E/AndroidRuntime(25438): at android.os.Handler.(Handler.java:121)
04-10 13:28:47.954: E/AndroidRuntime(25438): at de.tavendo.autobahn.WebSocketConnection$ThreadHandler.(WebSocketConnection.java:526)
04-10 13:28:47.954: E/AndroidRuntime(25438): at de.tavendo.autobahn.WebSocketConnection.(WebSocketConnection.java:65)
04-10 13:28:47.954: E/AndroidRuntime(25438): at com.taxi.driver.DdpClient.connect(DdpClient.java:151)
04-10 13:28:47.954: E/AndroidRuntime(25438): at com.taxi.driver.DriverService.logMeIn(DriverService.java:728)
04-10 13:28:47.954: E/AndroidRuntime(25438): at com.taxi.driver.DriverService.connectMe(DriverService.java:790)
04-10 13:28:47.954: E/AndroidRuntime(25438): at com.taxi.driver.DriverService$BackgroundTimer.run(DriverService.java:200)
04-10 13:28:47.954: E/AndroidRuntime(25438): at java.util.Timer$TimerImpl.run(Timer.java:284)

if started from the main UI thread ,working great

@palmerc
Copy link
Owner

palmerc commented Apr 21, 2013

Can you give any details on this? How you managed to get it to crash?

@elidor86
Copy link
Author

I setup a timer to check every X seconds that the connection is still alive and working, if the socket seems to be dead i reconnect to the server, during this reconntion i got this error, solved it withe getting the main looper and run it from the main ui thread

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