From 8d340d587edc71d1b85bd29e45905665af47db40 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 14 Jan 2014 20:48:39 +0000 Subject: [PATCH] Added an assertion for android to catch use of HTTP on the main thread (not allowed by the OS) --- modules/juce_core/native/juce_android_Network.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_core/native/juce_android_Network.cpp b/modules/juce_core/native/juce_android_Network.cpp index c551edaa1a..40478d4b63 100644 --- a/modules/juce_core/native/juce_android_Network.cpp +++ b/modules/juce_core/native/juce_android_Network.cpp @@ -87,6 +87,10 @@ public: LocalRef responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.constructor)); + // Annoyingly, the android HTTP functions will choke on this call if you try to do it on the message + // thread. You'll need to move your networking code to a background thread to keep it happy.. + jassert (Thread::getCurrentThread() != nullptr); + stream = GlobalRef (env->CallStaticObjectMethod (JuceAppActivity, JuceAppActivity.createHTTPStream, javaString (address).get(),