• Home
  • Agro
    • Agro
    • Akuaponik
    • Hidroponik
    • Ayam Kampung
  • DIY
    • DIY
    • Rumah Kampung
  • Tech
    • Tech
    • Titanium Mobile
  • Media
    • Media
    • Downloads
    • Dashcam Drive
  • Misc
    • Random
    • Food
    • Photography
    • Ideas
    • E-mau
  • Home
  • Agro
    • Agro
    • Akuaponik
    • Hidroponik
    • Ayam Kampung
  • DIY
    • DIY
    • Rumah Kampung
  • Tech
    • Tech
    • Titanium Mobile
  • Media
    • Media
    • Downloads
    • Dashcam Drive
  • Misc
    • Random
    • Food
    • Photography
    • Ideas
    • E-mau
#Android  #Javascript  #Titanium Mobile  #WebView

Webview evalJS return null in Android 4.2.2

On 3 October 2013 in Tech

I have a webview that points to external URL

var webview = Ti.UI.createWebView({
	url: 'http://example.com/test.html'
});

In test.html I have a global variable

<script type="text/javascript">
var myvar = JSON.stringify({ status: true });
</script>

On webview onload event, evalJS('myvar') return null, and inside log message got “Timeout waiting to evaluate JS”. After a few days try & error, test and compare, finally I found the culprit is within tiapp.xml file.

My tiapp.xml has a customized <android> section

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <tool-api-level>17</tool-api-level>
  <manifest android:installLocation="auto" android:versionCode="1" android:versionName="1.0.0">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
    <application>
      <activity android:configChanges="keyboardHidden" android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
    </application>
  </manifest>
  <services>
    <service type="standard" url="lib/service/clear.js"/>
  </services>
</android>

It turns out that <uses-sdk> part is the one causes this bug. Removing the line <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> fix this bug and I can retrieve myvar values using evalJS() again.

Share this post:
  • Share0
  • Tweet
  • Pin0
  • LinkedIn

Related posts:

  • Ti.Network.registerForPushNotifications no response
  • Titanium Studio mark occurences
  • Object oriented Javascript with CommonJS in Titanium app
  • Creating [object] in a different context than the calling function.
  • Titanium iOS “build” is an unrecognized command
  • Method calling thread for Titanium module (Android)
  • Titanium Studio unbound classpath container error
  • Load nib file in Titanium module iOS
  • Titanium app hex color value with alpha channel
  • Android Popup Menu module for Titanium

Filed under Tech with tags Android, Javascript, Titanium Mobile, WebView

Post navigation

Previous Post Previous post:
Logcat
Next Post Next post:
Check process that prevent unmount USB drive

2 comments

  • Comment by Frederick 11 August 2014 at 8:05 pm - Reply

    I see you share interesting content here, you can earn some additional money, your blog has
    big potential, for the monetizing method, just search in google – K2 advices
    how to monetize a website

  • Comment by Hazem Khaled 28 February 2016 at 11:51 pm - Reply

    Thanks for sharing, not working with me, any ideas?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Social media

  • facebook
  • instagram
  • twitter
  • pinterest
  • youtube

Search

Subscribe

Follow

Popular posts

  • Saiz standard kayu, papan dan plywood
  • Slack MacOS client keep crashing
  • Kpop Idol Groups International Fan Forum
  • Check if iOS app is connected to VPN
  • Pemasangan dinding plywood rumah kampung secara solo
  • Setup fish tank solid lifting overflow
  • Jenis skru kayu
  • 3 Jenis Asas Sistem Hidroponik Yang Digunakan Dalam Akuaponik Serta Variasinya

Recent Posts

  • Dashcam Drive #14 – Giant Petra Jaya → KFC Metrocity11 December 2019
  • Tanaman cili padi — kawasan tanaman6 December 2019
  • Dashcam Drive #13 – Borneo 744 → Pengkalan Sapi4 December 2019
  • Tanaman cili padi — pindah ke polibag29 November 2019
  • Dashcam Drive #12 – Borneo Convention Center Kuching (BCCK) → Borneo 74427 November 2019
  • How to download Running Man subbed videos (or other shows) from streaming website26 November 2019
  • Tanaman cili padi — semaian22 November 2019
  • Dashcam Drive #11 – Mydin Petra Jaya → Emart Xpress Demak Laut20 November 2019

Tags

1N2D Akuaponik Android Apache Ayam Kampung Bash C# Cache Cili CommonJS Controller Dashcam Drive Database E-mau Fedora Food Git Gnome Happy Together Hidroponik Ideas Invincible Youth iOS Java Javascript Ke Indonesia Ke Kita? Ke Jepun Ke Kita? Ke Korea Ke Kita? ListView Mr. Bean Photography PHP Python Rant Roundtable Plus RPM Rumah Kampung Star Golden Bell Subversion SVN Titanium Mobile Titanium Module Titanium Studio windows phone WrestleMania

Archives

About me

I'm a software developer by profession, develop specifically mobile app using Swift (iOS) & Java (Android), and also web app using PHP, MySQL & Javascript. This blog is a place for me to share my side projects and interests, mostly about farming, DIY woodworking, computer-related notes, dashcam drive, food review, photography, cats and more.

© 2019 Noodlecode

Back to top
sponsored