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

Speak Activity: android.os.NetworkOnMainThreadException #29

Open
13rac1 opened this issue Jan 24, 2015 · 3 comments
Open

Speak Activity: android.os.NetworkOnMainThreadException #29

13rac1 opened this issue Jan 24, 2015 · 3 comments

Comments

@13rac1
Copy link
Member

13rac1 commented Jan 24, 2015

The system throws android.os.NetworkOnMainThreadException when the user presses the "Stop" button once they are done recording.

01-23 18:59:23.009  29599-29599/org.famsf.roundware D/RWService﹕ Received broadcast intent with action: org.roundware.service.action.log_event_success
01-23 18:59:24.751  29599-29599/org.famsf.roundware D/RWHttpManager﹕ GET request: http://example.com/api/1/?operation=log_event&haccuracy=1.0&longitude=-122.469352&client_time=2015-01-23+18%3A59%3A24.-0800&session_id=20947&event_type=stop_record&latitude=37.770912&project_id=14
01-23 18:59:24.771  29599-29599/org.famsf.roundware E/RWService﹕ Error: null
    android.os.NetworkOnMainThreadException
            at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
            at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
            at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
            at java.net.InetAddress.getAllByName(InetAddress.java:214)
            at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
            at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
            at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
            at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
            at org.roundware.service.RWHttpManager.doGet(RWHttpManager.java:82)
            at org.roundware.service.RWAction.perform(RWAction.java:107)
            at org.roundware.service.RWService.perform(RWService.java:1611)
            at org.roundware.service.RWService.perform(RWService.java:1553)
            at org.roundware.service.RWService.rwSendLogEvent(RWService.java:1392)
            at org.roundware.service.RWRecordingTask.stopRecording(RWRecordingTask.java:159)
            at org.roundware.rwapp.RwSpeakActivity.stopRecording(RwSpeakActivity.java:870)
            at org.roundware.rwapp.RwSpeakActivity.access$1300(RwSpeakActivity.java:64)
            at org.roundware.rwapp.RwSpeakActivity$3.onClick(RwSpeakActivity.java:388)
            at android.view.View.performClick(View.java:4445)
            at android.widget.CompoundButton.performClick(CompoundButton.java:100)
            at android.view.View$PerformClick.run(View.java:18446)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
            at dalvik.system.NativeStart.main(Native Method)
@13rac1 13rac1 added the bug label Jan 24, 2015
@13rac1 13rac1 added this to the FAMSF Store submission milestone Jan 24, 2015
@multidynamic
Copy link
Contributor

It appears RwService.perform is the meat of the stack and it does not appear it needs to run on the ui thread. (Notifications should run fine off of worker threads.) Perhaps perform's driver function:

 protected String perform(RWAction action, boolean now)

can start a thread?

@multidynamic
Copy link
Contributor

Duplicate of issue #60

@13rac1
Copy link
Member Author

13rac1 commented Feb 20, 2015

Later issues are dupes.

@13rac1 13rac1 reopened this Feb 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants