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

Crash when trying to recieve a message when app has been closed #66

Closed
mrwhale opened this Issue Jun 26, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mrwhale
Contributor

mrwhale commented Jun 26, 2016

So not sure if this one happens with the Wear aswell (haven't tested yet) but after I force close the app, I get a error.
The log below shows normal usage when the Light Controller app is in the foreground, then the Destroy() is when I've forced closed it, then I attempt to turn a light off from the pebble after destroy, I get the resulting crash

06-26 21:08:44.119 1435-1435/tv.piratemedia.lightcontroler D/Utils: get Broadcast
06-26 21:08:44.138 1435-1435/tv.piratemedia.lightcontroler D/pebble app R: on recieve
06-26 21:08:44.142 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: APP UUID -769877de-70dc-4d8b-ae10-3dbc8f5d1619- this
06-26 21:08:44.151 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: going to turn zone 1 cmd 0
06-26 21:08:44.155 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: got data
06-26 21:08:44.155 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver:  ZONE 1
06-26 21:08:44.183 1435-1435/tv.piratemedia.lightcontroler D/Utils: get Broadcast
06-26 21:08:44.201 1435-1435/tv.piratemedia.lightcontroler D/pebble app R: on recieve
06-26 21:08:48.707 1435-1435/tv.piratemedia.lightcontroler D/Utils: get Broadcast
06-26 21:08:48.736 1435-1435/tv.piratemedia.lightcontroler D/pebble app R: on recieve
06-26 21:08:48.737 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: APP UUID -769877de-70dc-4d8b-ae10-3dbc8f5d1619- this
06-26 21:08:48.737 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: going to turn zone 1 cmd 1
06-26 21:08:48.840 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver: got data
06-26 21:08:48.840 1435-1435/tv.piratemedia.lightcontroler D/Pebble Receiver:  ZONE 1
06-26 21:08:48.857 1435-1435/tv.piratemedia.lightcontroler D/Utils: get Broadcast
06-26 21:08:48.877 1435-1435/tv.piratemedia.lightcontroler D/pebble app R: on recieve
06-26 21:08:52.044 1435-1435/tv.piratemedia.lightcontroler D/controller: destroy
06-26 21:08:53.581 1905-1905/tv.piratemedia.lightcontroler W/System: ClassLoader referenced unknown path: /data/app/tv.piratemedia.lightcontroler-1/lib/arm
06-26 21:08:53.616 1905-1905/tv.piratemedia.lightcontroler I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
06-26 21:08:54.420 1905-1905/tv.piratemedia.lightcontroler D/Utils: get Broadcast
06-26 21:08:54.432 1905-1905/tv.piratemedia.lightcontroler D/pebble app R: on recieve
06-26 21:08:54.434 1905-1905/tv.piratemedia.lightcontroler D/Pebble Receiver: APP UUID -769877de-70dc-4d8b-ae10-3dbc8f5d1619- this
06-26 21:08:54.442 1905-1905/tv.piratemedia.lightcontroler D/Pebble Receiver: going to turn zone 1 cmd 0
06-26 21:08:54.444 1905-1905/tv.piratemedia.lightcontroler D/AndroidRuntime: Shutting down VM
06-26 21:08:54.445 1905-1905/tv.piratemedia.lightcontroler E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: tv.piratemedia.lightcontroler, PID: 1905
                                                                             java.lang.RuntimeException: Unable to start receiver tv.piratemedia.lightcontroler.pebble.pebbleReceiver: android.os.NetworkOnMainThreadException
                                                                                 at android.app.ActivityThread.handleReceiver(ActivityThread.java:2732)
                                                                                 at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                              Caused by: android.os.NetworkOnMainThreadException
                                                                                 at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1273)
                                                                                 at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:276)
                                                                                 at libcore.io.IoBridge.sendto(IoBridge.java:509)
                                                                                 at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:184)
                                                                                 at java.net.DatagramSocket.send(DatagramSocket.java:305)
                                                                                 at tv.piratemedia.lightcontroler.UDPConnection.sendMessage(UDPConnection.java:76)
                                                                                 at tv.piratemedia.lightcontroler.controlCommands.LightsOff(controlCommands.java:218)
                                                                                 at tv.piratemedia.lightcontroler.pebble.pebbleReceiver.onReceive(pebbleReceiver.java:69)
                                                                                 at android.app.ActivityThread.handleReceiver(ActivityThread.java:2725)
                                                                                 at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                 at android.os.Looper.loop(Looper.java:148) 
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                 at java.lang.reflect.Method.invoke(Native Method) 
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
@eliotstocker

This comment has been minimized.

Show comment
Hide comment
@eliotstocker

eliotstocker Jun 26, 2016

Owner

ok, this can be fixed by adding the following to the top of the pebble listener:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);

Owner

eliotstocker commented Jun 26, 2016

ok, this can be fixed by adding the following to the top of the pebble listener:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);

@mrwhale

This comment has been minimized.

Show comment
Hide comment
@mrwhale

mrwhale Jun 27, 2016

Contributor

Nice! yep that seemed to do the trick, Thanks 👍

Contributor

mrwhale commented Jun 27, 2016

Nice! yep that seemed to do the trick, Thanks 👍

@mrwhale mrwhale closed this Jun 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment