HTML5 application for PlayBook - how to "handle" gestures? - blackberry-playbook

I was asked to build a playbook app using HTML5. That's the first time I'm going to work with Playbook, and I do not have any experience with it. I googled a bit, and looks like I can use WebWorks to create HTML5 application which can be deployed on Playbook. So that should not be a problem. Here are my questions:
Does that HTML5 app supports gestures (left/right swipe, multitouch, etc)?
If yes - how to capture them (if I'm using jQuery, for example)?
Are there any restrictions in gestures comparing to "native" app?
Can you please point me to the document/tutorial for jQuery and gesture integration with WebWorks?
Thank you.

Yes
Yes, javascript. Or a library like jQuery / jqMobi, etc. Lots out there.
No.
Look at the Kitchen Sink touch/gestures sample.

Related

HTA Gamepad API (or alternatives)

I am building an game launcher app (similar to Steam Big Picture) using HTA and I'd like to be able to control this app using my X360 controller.
One way to do it is to use Xpadder and emulate keyboard presses, but since MS Edge has a native support of Gamepad API, I wonder whether there is a way to enable it for HTA (since for example flexboxes can be enabled for HTA).
Or.. if it's not possible, are there any alternatives for HTA? That means something I can write in HTML5+CSS3+Javascript, have it start in fullscreen and have it launch .bat files on my computer without asking for any permissions?
Judging by this answer to a similar-ish question...
I suspect that an HTA would work in Windows 10, but only in IE9 mode. It would be a major shift if Microsoft built Edge with HTA support.
I would conclude you wouldn't be able to use the Gamepad API in a HTA because it uses the IE 9 rendering engine.
Your best bet is give it a try and test it for yourself.
Useful Links
Can I use Gamepad API?

Will a Flex app run on a mobile device?

Can a Flex application that was designed for use on a PC be run on an iPad, iPhone, or Android-based mobile device?
Seems like a simple enough question. Visiting http://www.adobe.com/products/flex.html yields a picture of a dude running a (presumably) Flex application on an Android. So at first glance, the answer would appear to be "yes." End of story.
but yet…
There is so much (mis)information out there on various tech sites that suggest Flash-based technologies simply won't run on iOS or other mobile platforms. Why is this? Perhaps they mean to say that Flex won't run "out of the box" and requires a plugin? Or do they mean it won't run at all?
Every time I think I've reached a definitive conclusion, some post on SlashDot or CNET directly contradicts it. So what's the scoop? Can one take an existing Flex application and run it on iOS/Android? (I realize there are screen size issues to consider so the app might not run effectively. I just want to know if the runtimes are available on the mobile devices to allow the Flex app to launch at all.)
Sorry for the noob question. My background is WPF / HTML5. Adobe technologies are completely foreign to me.
I wrote a lot below if you'd like to read it enjoy, if not sorry for taking your valuable bytes :) I directly answered the questions up here first:
Why is this?
It's a confusing matter read below for the why details.
Perhaps they mean to say that Flex won't run "out of the box" and requires a plugin?
Or do they mean it won't run at all?
Using the flash builder tools (the bin folder in the SDK) you can compile for native desktop application, desktop web browsers, native iOS application, native Android application. Android with FlashPlayer plugin installed will show Flash content within the web browser, iOS will only run the ones compiled with AIR, not in the the web browser but as a native app.
Every time I think I've reached a definitive conclusion, some post on SlashDot or CNET directly contradicts it. So what's the scoop? Can one take an existing Flex application and run it on iOS/Android?
Yes, if using AIR and run as a native app on all three platforms (the desktop Flex API is for the most part a superset of the web Flex API), your other points about performance and form factor are valid and should be considered though. The nice thing is you can write your model/controller code in a common library in AS3 then write separate presentation layer interfaces that all share the library.
Here's the very long version:
Using the flash compiler results in "bytecode" in the form of a file with a swf extension using the swf format, you can read a ton more about that here:
http://www.adobe.com/devnet/swf.html
To interpret the file you need some sort of run-time similar to some degree to running WPF/XAML/C# within a .NET framework context (either desktop or using silverlight on the web). In the case of adobe technologies (rough equivalence):
AS3 = C#
MXML = XAML
Flex = WPF+WCF (client side RPC not server side)
Flash Player = Silverlight
AIR (Adobe integrated runtime) = .NET
Framework Redistributable .dll(s)/.so(s) for desktop OSes
(Read this list very loosely please, I know XAML is preserved in the MSIL or whatever which is different because MXML is compiled to AS3 and only if a debug flag is set on the compiler does it include the debugging symbols, there's certainly tons of differences but I think this is an easy and correct enough model to use)
On iOS the browser does not allow for plugins in the traditional sense of netscape browser plugins or ActiveX plugins. For this reason you'll not be able to execute a plugin ie flashplayer or silverlight in the browser. Since Adobe did release a flashplayer for Android devices that does run in the browser it will work on those devices in the browser, however they have essentially thrown in the towel for supporting this long term, as they have to support the majority mobile device platform, iOS, in order to remain relevant (this was I think more a collective throwing in of the towel by Google, device manufacturers, carriers, Microsoft, all just following suit and trying to make the best business decision, WebKit and V8 or SpiderMonkey can probably do 99% of what Flash can do and better in some cases and WebKit will hopefully not splinter and will remain open source... frameworks and the browsers just need to get fleshed out and stabilized).
If the user installs AIR (or the runtime is packaged with the app) then a Flex/Flash (that is stuff coded in AS3 and/or MXML and compiled to a swf) can be transcoded/packaged to be interpreted by the run-time for that device correctly (be it iOS or Android or whatever RIM did, I don't think they have AIR for Windows Phone 7 and Win8 on ARM won't support browser plugins either). Part of the confusion is possibly from the fact that Apple denied the distribution of Apps that were "cross-compiled" which kept AIR out of the list of options for iOS for a good year, just after Adobe started announcing it was usable for that purpose (kicking Adobe while their down). Another part of the confusion probably comes from real vids of people who have 1 hacked their device or 2 were able to get open source alternatives to the flash player run-time to work on their iOS device (gnash was one I'm aware of from some occasional Linux tinkering, also possibly FAKE vids).
You can run Flex applications on mobile devices, but you cannot simply run any Flex project.
In Flash Builder ( Flex Ide) or in Flash Professional you can create mobile projects. These projects generate native applications for iOS and Android.
Last time I tried, the result and the available components where less than what I expected. So, if you can, I'll much recommend you go for something like Appcelerator.com or similar, which turns HTML5/Js code into native apps. I tried them, worked a lot better than Flex.
Short answer: No
Long answer: You can use Adobe's tools to compile your Flash/Flex app for use as a native iOS app. So you won't be able to embed the app in a web page like you normally could with Flex, but you can build it as a native app. Note you have to have Flash Builder 4.5 to do this.
It won't run on iPhone as a .swf file, but it will run on Android based devices that have adobe flash installed. It will also run on the BB playbook, which also has flash.
Flex is a framework.( Anyway it is very beutiful one which even sometime looks like complete different language ).
As soon as you are building AIR application it can run on various platforms like : Windows, iOS, Android, upcomming TV's, PlayBook, even .. into the future ( maybe/hopefuly ) on Windows Phone, plus Linux ( which AIR future is not very clear anyway ( but hopefuly Adobe will reconsider ) ).
So - application created with Flash Builder 4.5+ would probably run everywhere as soon as it is AIR application.
The compilation methoods is really simple, and you almost simultaneously compiling for everything you wanna to.
And one of the most important things here - your applications will run, work, look and feel the same way you were designed on one device. Flex is the thing which is responsible for everything to looks beutiful on each platform it is running.
For instance i am compiling currently for Android, and without even test i can clearly say that it will looks and feel the same way under iOS and Windows, and it will.

Is it possible to upload a picture through a web browser from a mobile device?

This question has been asked before, but not this year - there is no concrete consensus and I know this is a hot topic. In addition, technology changes rather quickly, and the other questions seem to relate to only using the <input type="file>. I am looking for a more verbose modern way to handle these requests. Although I have been developing in ASP.NET C# MVC3, I have been looking into weather ASP.NET MVC4 Mobile will support mobile file upload. From what I have read, it does not, or it has not been covered in the new release notes.
http://www.asp.net/vnext/overview/whitepapers/whats-new
http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-4-mobile-features
From the research I have done jQuery-Mobile seems rather gimmicky.
http://www.parorrey.com/blog/jquery-mobile/file-input-field-uploading-using-jquery-mobile-framework-form-submission-with-ajax-disabled/
http://forum.jquery.com/topic/jquery-mobile-seems-to-clobber-ability-to-upload-files-via-forms
An example that was posted did not work on my iPhone, as the <input type="file" still existed and was therefore grayed out as inaccessible.
http://filamentgroup.com/examples/jquery-custom-file-input/
Another suggestion I have come across involves forcing the user to email the photo to a user-specific email which doesn't really appeal to me or the customers I deal with - this approach also seems like it could be vulnerable to security breaches.
IS there a way to do this that I have overlooked? How can I show a file dialog on a mobile device?
The Safari browser does not support file uploads. You can see this by visiting many of the mobile sites in the actual browser BUT the actual apps will allow this.
So if you are making a mobile web app that you wish to deploy as a native app, you can use phonegap as a layer to do this.
http://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#FileTransfer
Also, it is supported in:
Android
BlackBerry WebWorks (OS 5.0 and higher)
iOS
Windows Phone 7 ( Mango )
I use jquery mobile in a production app and it works just fine. I don't do file upload with it; however, that isn't jquery mobile's job anyhow. JqueryUI has issues with its dialog and file upload as well. There are a number of scripts that help with that. I use ajaxfileupload: http://www.phpletter.com/Our-Projects/AjaxFileUpload/ there are better ones out there now though.
I digress. As far as mobile is concerned it is more useful to have camera features involved rather than pure fileupload. No one knows where they store things on their phones, which is part of the problem. For that case you may want to try phonegap. Try this: http://wiki.phonegap.com/w/page/18270855/Image%20Upload%20using%20JQuery%20and%20Python
Yes we can upload picture through mobile,
Face book is a live example for this.
It works for me on Android.
You can see how facebook does it here: https://m.facebook.com/home.php?refsrc=http%3A%2F%2Fm.facebook.com%2F&refid=8&_rdr
<input type="file" name="file1" data-sigil="photo-input" />
Try going to www.tinypic.com and uploading a photo. I can test on iPhone tonight.
This works fine on Android 2.2+. You can upload photos from your gallery or use the camera to take a new picture for uploading. Any other apps that expose similar behaviour like sound recorders, the camcorder and music apps will typically offer alternatives. If you have a good filesystem app installed this will normally allow you to upload arbitrary files.
On iOS, you have to use an app to upload files. Since this is such a glaring omission in this age of web apps, it is very likely this feature will be added in the next major release of iOS although that is likely a few months away still.
Try this:
<input type="file" accept="image/*;capture=camera">
This should be supported in most mobile browsers and should offer the user a chance to choose a local file (image) or one some modern devices even allow them to capture one in the process.
Hope this helps!
Use Phonegap to bridge the gap between client side libraries and native applications. While the client side libraries give a good handle and easy way to set UI things up, you can use the capability of phonegap to perform device specific operations like camera, scanning, call etc.
Mobile browsers in Android (pre 2.2 it seems) and iOS do not allow file system access. And when it does on Android 2.2+ it isn't full access - it is filtered via apps that hit the FS like Gallery or Music.

Flash Browser? Flash Server Side?

I have two noobish questions about Flash, Actionscript, Flex etc.
1) With these technologies is it possible to create a simple web browser that can render websites?
2) Is it possible to run these technologies on the server side? I am guessing no as Flash requires a browser to run within?
Thanks all for any help
HTML in Flash
Technically you can write an HTML rendering engine in Flash. DENG is an old project that did exactly this. I don't think it's still be updated though.
http://osflash.org/deng
Adobe AIR supports rendering HTML in the embedded WebKit based engine within Flash.
Flash on server
The standalone Flash Player can be used on the server and is often used for unit testing within a continuous integration environment. When run from a background service I don't think it will actually display a UI, but it will run.
Take a look on this article http://www.adobe.com/devnet/air/flash/articles/air_browser_sample_application.html - it describes how to build your browser with Flash/Air (running on the desktop)

Automated testing of FLEX based applications

What tools, preferably open source, are recommended for driving an automated test suite on a FLEX based web application? The same tool also having built in capabilities to drive Web Services would be nice.
Adobe distributes a test framework themselves: FlexUnit.
I heard of people using selenium as a free/open source testing tool. A quick google revealed a FLEX API for it. Not sure if it works or is still in development, but it may be worth a look.
http://sourceforge.net/projects/seleniumflexapi/
Are you looking to script code-level unit tests? If so, dpuint is the bomb: http://code.google.com/p/dpuint/ . This library makes it really easy to do automated testing on all sorts of asynchronous events, on either non-visual ActionScript objects or visual components. They also have a nice multi-page tutorial on the Google Code project page.
If you are looking for functional testing tools along the lines of automated record-and-playback simulating an end user using a Flex app, HP's QuickTest Pro is the Adobe-endorsed solution. It works great, but costs about $4,000 - $6,000 per seat.
Check out FlexMonkey. It does automated testing via FlexUnit tests.
Try looking at Melomel. It has Cucumber support baked right in and comes packaged with steps for most Halo and Spark components.
http://melomel.info
There's an automated test tool called RIATest that might fit the bill for you.
Unfortunately only for Windows, and not open source, but if it does the job it might be well worth the price ($399 at time of writing).
FunFX is an option for automating UI testing. I haven't used it extensively, but I've heard of some having success with it. Here is the article where I first learned about it.
I've been extensively using FunFX for several months now on a Flex 3 + Rails project. Not only is it open source, it's also written in Ruby, so integration with web services should be fairly easy. There are a few screencasts out there covering the basics.
The Flex code that your Flex app needs is contained in the SeleniumFlexAPI distribution .swc file, SeleniumFlexAPI.swc. Just include this file as a library when you compile your Flex app.
Sikuli is good tool which can be used to test flex/flash based web applications.
-It can automate anything on graphical user interface.
-It works on Windows, MAC OSX and Linux as well as iPhone and Android.
-Here is the Sikuli link
My preferred tool is Selenium Remote Control. There is a plug-in I discovered a few months ago:
http://code.google.com/p/flash-selenium/
This required 'hooks' to be written on the server side (ActionScript/Flex). Once they were added, I was able to do some browser testing using Selenium RC.
FunFX is great. We've used it extensively and have been very happy with it. The community is also active and very responsive, so that is a big plus for me.
The new version of the Selenium-Flex API (0.2.5) works great.

Resources