Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Sunday, March 30, 2014

Use Adobe Air to build a mobile APP for your Blog

With Adobe Air, you can easily create a mobile APP for your Blogger powered blog site. What you need is the StageWebView class, which can load and show any html/javascript based web site on the stage within your APP.

But firstly, go to your Blogger dashboard, in the Template tab, enable the Mobile template. (See this post for more details: http://blogger-hints-and-tips.blogspot.com/2012/05/mobile-templates-for-blogger-and-why.html) After this, when visit your Blogger site from mobile device (via mobile browser or APP), your blog will be displayed in a mobile friendly way.

Next, all we need to do is to load your blog url and display it on the stage using the StageWebView class. Here are some code:

var webBrowser:StageWebView = new StageWebView();
webBrowser.stage = this.stage;
webBrowser.viewPort = new Rectangle(0, 0, this.stage.stageWidth, this.stage.stageHeight);
webBrowser.loadURL("http://yourblogurl.blogspot.com");

With these code, the Air APP can load and display your blog by itself. Sometimes, you want to call the device's browser for opening the external links - links not belong to your blog, so the APP behaves more like a blog APP other than a simple browser for viewing any url. To do this, you can use the LOCATION_CHANGING event of the StageWebView class. Whenever a user clicked a link, check if it is an external link, then decide whether to display it within the APP using StageWebView class or use the navigateToURL method to open the link by external web browsers. The code:
webBrowser.addEventListener(LocationChangeEvent.LOCATION_CHANGING, onLocationChanging);
function onLocationChanging(event:LocationChangeEvent):void
         {
                   var newURL:String = event.location;
                   if (newURL.search('blogspot.') == -1)
                   {
                   event.preventDefault();
                   navigateToURL(new URLRequest(newURL));
                   }
          }

Besides, we may also interested in the "historyBack()" and "historyForward()" methods. With these two methods, you can navigate to the previous/next page in the browsing history. Actually, you can even create a fake mobile browser using the API provided by StageWebView class after adding UIs.

Finally, if you want, you can publish your Blogger site with the mobile app to Google Play or the App Store.

The Demo of my Blog (APK for Android):
https://drive.google.com/file/d/0B5V2PrQ8xX_EbzA4TzdBNUwzZXc/edit?usp=sharing

Full FlashDevelop project with source code:
https://flaswf.googlecode.com/svn/trunk/flaswfblog/Tutorials/BloggerApp/

Links:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageWebView.html
http://help.adobe.com/en_US/as3/dev/WS901d38e593cd1bac3ef1d28412ac57b094b-8000.html
http://www.adobe.com/inspire-archive/february2010/articles/article5/index.html
http://www.adobe.com/devnet/air/quick_start_as/quickstarts/qs_using_stage_web_view.html
http://www.flashandmath.com/mobile/swv/
http://www.yeahbutisitflash.com/?p=3996
http://thatsthaway.blogspot.com/2012/07/display-and-remove-documents-in-air.html
http://sjespers.com/blog/2011/05/17/displaying-ads-in-your-mobile-air-application/
http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/
http://www.lucentminds.com/archives/adobe-air-web-browser.html
http://sean.voisen.org/blog/2010/10/making-the-most-of-stagewebview/
http://www.as3gamegears.com/misc/stagewebviewbridge/

Monday, September 2, 2013

Linux on Android Installation Notes

Recently when I was browsing google play, I found this app " Complete Linux Installer". Never did I expect it is so easy to install Linux system on Android phones. Just tested Ubuntu 10.10 on my old Android phone (lenovo lephone p700), and it works! Although the screen size is very small and the control is awkward, an almost fully functional Linux distribution was installed on the phone. And now I can use FireFox to browse the web, GIMP to draw and Emacs to edit texts, really cool!

Here are some notes for installing Linux on android phone (make sure your phone is rooted first):
1. Download and install the Complete Linux Installer app on Google Play:
https://play.google.com/store/apps/details?id=com.zpwebsites.linuxonandroid

2. Choose and download one Linux distribution on Android:
http://sourceforge.net/projects/linuxonandroid/
I chose Ubuntu 10.10(ubuntuV5-image.zip):
http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/10.10/
After downloading, unzip and copy the file "ubuntu.img" to your phone's SD card.

3. Install Android Terminal Emulator:
https://play.google.com/store/apps/details?id=jackpal.androidterm
and android-vnc-viewer:
https://play.google.com/store/apps/details?id=android.androidVNC

4. Now, run the Complete Linux Installer app on your phone, go to Launch->Settings-Add, to add the file path of "ubuntu.img". After that, choose the added distribution from Launch,tap Start Linux.

5. Finally, open android-vnc-viewer, fill the Address with "localhost", Port"5900", Password "ubuntu", then tap "Connect". Now you're entering the Linux desktop.

Links:
http://www.linuxonandroid.org
solve the "Error: Unable to mount the loop device!" problem:
http://www.geekpeek.net/linux-on-android-2/
http://superuser.com/questions/220164/how-to-stop-the-d-key-from-minimizing-all-windows-in-ubuntu-10-10-when-connect
http://forum.linuxonandroid.org/index.php?topic=41.0
http://linuxonandroid.org/sudoroot-issues-how-to-fix/
http://sourceforge.net/p/linuxonandroid/wiki/Linux%20Image%20FAQ/

If you're trying ubuntu 10.10 on your android device and want to install some new software via the ubuntu software center:
How to install software or upgrade from old unsupported release?
http://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-old-unsupported-release
Requires installation of untrusted packages?
http://askubuntu.com/questions/184117/requires-installation-of-untrusted-packages

Monday, May 20, 2013

Watercolor Brush - New Version Released for Android!

Here comes the updated version of my simple & free painting tool - Watercolor Brush. This new version is much smoother than the old one.
Build with AIR, this is my first AIR project for mobile platforms.
Newer version for web will come soon and I may also release an IOS version in the future.


Download the APK (v0.1):
https://docs.google.com/file/d/0B5V2PrQ8xX_EeEszYlFNV0l0Y2s/edit?usp=sharing

Bugs, feedbacks, features requests are welcomed!

Finally, some notes for AIR mobile projets:

1. FileReference.save() works on AIR, but you need some declaration in "application.xml" to enable the save function:
http://richard-heck.blogspot.com/2011/01/how-to-write-file-to-android-filesystem.html

2. AIR Guesture events on mobile platforms:
http://paultrani.com/2011/02/touch-events-and-gestures-on-mobile/
http://www.flashandmath.com/mobile/zoompan/

3. Some optimization tips on AIR mobile performance:
http://www.andymoore.ca/2012/01/how-to-improve-your-mobile-as3air-performance/

The old version for WEB (Flash, outdated, new web version is coming soon):
http://bruce-lab.blogspot.com/2011/09/paint-online-with-chinese-water-color.html

Sponsors