From callback-dev-return-11522-apmail-incubator-callback-dev-archive=incubator.apache.org@incubator.apache.org Fri Aug 10 17:00:21 2012 Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 007C2C61C for ; Fri, 10 Aug 2012 17:00:21 +0000 (UTC) Received: (qmail 76565 invoked by uid 500); 10 Aug 2012 17:00:20 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 76533 invoked by uid 500); 10 Aug 2012 17:00:20 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 76515 invoked by uid 99); 10 Aug 2012 17:00:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2012 17:00:20 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of agrieve@google.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2012 17:00:16 +0000 Received: by obc16 with SMTP id 16so2459002obc.6 for ; Fri, 10 Aug 2012 09:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :x-system-of-record; bh=NPWvLqVSVhaMgJ8jZu/gW4HF9Br4bztOs78kFtottdM=; b=m+V+mYaD3rOtXQS5riy9I/mitY+zsuSk3lt+VysJErv/p9rX8E17DyZD5sX3ewy42L 0WLJk9jxuyFdR9KgvRvpgbeWWkSF77iwBm8nG3y8OnQwNfYL7hnyat3UMaWe9QWlF/t2 ct3dq2ZJib9LMraVvOyNp9xC0E1uRrRLJxE+gdTa0g/ysicVWgWmRV4WHj0QFISex7xJ JiNba4ZXozBd651DL77CQU0huRuOzL+DNuAHWtuCjOlNzUsQH4x+jbDU3QkOaCtCcmNu I7vPjKTPM9pqA3Eg9A2yWinjQnXyi0GWeDrDVqmcfT6BAIfhOMK3hzc+yuazKmcyVjhY HLEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :x-system-of-record:x-gm-message-state; bh=NPWvLqVSVhaMgJ8jZu/gW4HF9Br4bztOs78kFtottdM=; b=gb4ozR8HfODlT75TcXs2AXRcjPhLst51bZum3bz4ZAz3hmJxcMP3csRRCMl64kprCY 8+FBHXby5yH/ppF6G7ELTISDwXTwbR7wnVMU3Q9iflygjC6W+lKlANG5/0i1VxZifq97 97Hcc+aAGr+0chh5mmgDznO6maPAhPtToPPgyd2fMwvyhNmGUNiAMJHfhM150jBA6Jwf UDwTmCroF+SQSfl5ZPc3p/6vctDaFfyfRIqqGZcGlT13BskjqZOVxYQeYACze4CvaldK Oz6VbXvOwYedVwnurjdxJlXx/ydR9Y0lHvMXD099OrB1c6TNYKBvfjCZvCD0z5M7V3T0 Szug== Received: by 10.182.144.104 with SMTP id sl8mr4966763obb.74.1344617995433; Fri, 10 Aug 2012 09:59:55 -0700 (PDT) Received: by 10.182.144.104 with SMTP id sl8mr4966755obb.74.1344617995259; Fri, 10 Aug 2012 09:59:55 -0700 (PDT) MIME-Version: 1.0 Sender: agrieve@google.com Received: by 10.182.207.97 with HTTP; Fri, 10 Aug 2012 09:59:35 -0700 (PDT) In-Reply-To: <04a201cd7706$49c0e5a0$dd42b0e0$@com> References: <1144280150015843892@unknownmsgid> <04a201cd7706$49c0e5a0$dd42b0e0$@com> From: Andrew Grieve Date: Fri, 10 Aug 2012 12:59:35 -0400 X-Google-Sender-Auth: KOlgN683CzscjPpCmrUQeAOyupA Message-ID: Subject: Re: [Android] loadUrl, input methods and making the web a thread-safe place To: callback-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=14dae93998ddf74ecc04c6ec45e3 X-System-Of-Record: true X-Gm-Message-State: ALoCoQnERrlUj1MBxu8yXjhipJrQhhytPY/0mSKnjIb/xHniQR5aeqyJYtjLxISFg58eRVz35xa8GJIBvNnugIMmIw5eD/YTlwk67SPltJKL+zvk1goYOW4ZgceCvyMmyg080vudUg2+h7y52P7vObMHo9omeP4KploSmob8BUpNmxLaH8a/IFjUVOReP5om8Oi+HbKhcWMmJ/o1pkxPQudqELY+w4kztQ== X-Virus-Checked: Checked by ClamAV on apache.org --14dae93998ddf74ecc04c6ec45e3 Content-Type: text/plain; charset=ISO-8859-1 I know that the team didn't want to provide s synchronous API for stringByEvaluatingJavaScriptFromString because the performance would be quite bad due to having to block on the WebCore thread. Why there is not async API, such as exposing the one you point out, I don't know :(. That said, we are able to use the API you pointed out via reflection, and we should consider this as an option as well. The follow code does seem to work on Android 2.2 and 4.1: https://github.com/agrieve/incubator-cordova-android/commit/2400a63e8a64ab5e1d1de7bf30203eaed394781f If we go this route, we can still fall back on another technique if a future android version changes the private API it relies on. On Fri, Aug 10, 2012 at 10:41 AM, Jonathan Bond-Caron < jbondc@gdesolutions.com> wrote: > On Thu Aug 9 11:07 PM, Andrew Grieve wrote: > > > > Going Native->JS > > 1) Poll using 1) from above. (async) > > 2) Poll using 2) from above. (async) > > 3) Use loadUrl (breaks keyboard) (async) > > 4) Trigger an online/offline event and have JS pull in value using a > > sync > > JS->Native option (async) > > 5) Use a local server and hanging gets (async & complicated) > > > > Notes: > > -We currently use a combination of #1 and #5 > > -#3 is faster and simpler but breaks keyboard focus > > > > Out of curiosity, has anyone asked google why this is such a PITA? > > iOS has: UIWebView.stringByEvaluatingJavaScriptFromString > > The native java code binding to webkit already exists: > > https://github.com/android/platform_frameworks_base/blob/master/core/java/an > droid/webkit/WebViewCore.java#L1673 > > https://github.com/android/platform_external_webkit/blob/master/Source/WebKi > t/android/jni/WebCoreFrameBridge.cpp#L1489 > > Yet google 'hides' this API? Anyone know why? > > > --14dae93998ddf74ecc04c6ec45e3--