Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A case study in webview based android app devel...

kiang
November 07, 2012
330

A case study in webview based android app development

jquery mobile, phonegap, cordova

kiang

November 07, 2012
Tweet

Transcript

  1. Libraries • Phonegap / Cordova • Jquery Mobile • Jquery

    Tmpl • Jquery Validate • MobileScroll - date/time select
  2. Why Aptana Studio 3 ? • Netbeans was my favorite

    one before • NBAndroid is not active development • ADT in original eclipse is not good for developing webview based applications • Aptana is perfect for javascript editing • The default theme is good for my eyes...
  3. Google chrome? • It does support WebSQL • The business

    logic could be tested in desktop first, without the boring compiling time
  4. Why jquery mobile? • I like AngularJS more … •

    The designer have the UI first, based on jquery mobile • JQuery Mobile Angular Adapter is not that reliable, at least the document … • I don't have much experience in mobile environment. But I've been familiar with the coding style using jquery
  5. Rev #36 • Get the token from remote site •

    Save the token using window.localStorage.setItem('token', 'xxx'); • A login page • User could logout and then login again to get another token
  6. Rev #46 • Prevent the app being terminated when the

    orientation changing • AndroidManifest.xml <activity android:configChanges="orientation".. • MainActivity.java @Override public void onConfigurationChanged(Configuration newConfig){ super.onConfigurationChanged(newConfig); }
  7. Rev #63 • Enable the app for desktop(chrome) if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)

    ) { document.addEventListener("deviceready", function() { startApp(); }, false); } else { $(function() { startApp(); }) }
  8. Rev #91 • add page loading message if(i % 10

    === 0) { $.mobile.showPageLoadingMsg("a", "Loading..." + i +' / '+ queries.length, true); }
  9. Rev #127 • Mysql2sqlite https://gist.github.com/943776 • After executing the script,

    you must remove the following items: – Collat – Comments – Fix auto increasement fields
  10. Rev #132 • Once you used global variables, you just

    can't go back... • Preload the data sets as it's annoying to deal with timing issue for sql execution • In Single Page Application, global variable just like a session container, it will be there always • I will try to have a better habit, next time XD
  11. Rev #160 • You can't just change the value only,

    for jquery mobile UI components – obj.attr('checked', true).checkboxradio('refresh', true); – obj.html('xxx').trigger('create');
  12. Rev #172 • In sqlite, you usually have n+2 tables

    – sqlite_master – sqlite_sequence
  13. Rev #234 • use mobiscroll to replace datebox • Datebox

    is powerful, but slow on mobile device • Mobiscroll make the date/time picker work as expected