A JBoss Project
Red Hat

Posts tagged with 'aerogear'

Genymotion is an alternate Android emulator that is preferred by some developers for its better performance and accurate device emulation. Although, we have not specifically tried to support Genymotion as part of Hybrid Mobile tools, it is possible and easy to enable Genymotion for developing Cordova applications.

Emulator or device ?

Hybrid mobile tools uses ADB to work with Android devices and emulators. Fortunately, it is possible to use ADB to connect to Genymotion. which means that you still need the Android SDK installed for this to work.

By default, Genymotion uses its own Android tools but you can change it to use the tools from the Android SDK. After you start the Genymotion application, open settings using the Settings from the menu bar. On the settings dialog switch to ADB tab. Select Use custom Android SDK tools option and specify the location the Android SDK field. End result should look similar to the screen capture below.

Once Genymotion is configured to use ADB, start a virtual device from Genymotion application. ADB will recognize it as a device, rather than an emulator. Hereafter, you can use Run On Android Device from the run menu on Hybrid Mobile projects to test Cordova applications on Genymotion.

genymotion settings adb

So what happens when you already have a real device connected on debug mode? Unfortunately, you can work with only one device at a time, so you need to disconnect the device, to allow Genymotion to receive the application. You can follow the issue on Eclipse Bugzilla to find out when such use will be supported, and as usual, encourage for a quicker resolution.

Gorkem Ercan

The JBoss Developer Studio 8 and JBoss Tools 4.2 release enables developers to use these tools to build mobile applications by using the Apache Cordova framework. Apache Cordova (fka, PhongeGap) is a framework for building packaged mobile applications using web technologies such as HTML5, JavaScript and CSS3. In this article, I will explore different scenarios for getting started with the tools and Apache Cordova.

Where are the tools?

Hybrid mobile tools are not part of the default installation but getting them is easy. Although there are other ways, I usually use JBoss Central to pull them in. Here is how.

First switch to Software/Update tab on JBoss Central. Next select JBoss Hybrid Mobile Tools + CordovaSim. I usually select the AngularJS for Web Tools option before hitting the Install/Update, in order to get the improved support for Ionic framework.

Here is a screeen cast for getting started with the hybrid mobile tools.

1. Start a new Cordova project

This is the option when starting a new project or just experimenting with Apache Cordova development.It gives a basic project template that you can easily change and you can select the initial set of cordova plug-ins to include into your project. I usually add the console plugin at this time, to be able to use console.log() during development and remove it before the final export.

The video above not only shows how a project is created but also introduces the tools at your disposal going forward.

2. Import your existing Cordova application

If your Cordova application already exists and it was developed using a compatible tool such as Cordova CLI, you can import it easily and start using all the functionality available. Import process will also restore your plugins if you have been using the new cordova save command.

Here is a short video that shows the import feature in action.

3. Use existing mobile web site code

Often getting started with your packaged mobile application requires sharing the assets with a web application. We do support linking of resources from different locations to create a Cordova based mobile application. Although I do not recommend using artifacts, let alone whole web sites, that were created for desktop to be turned to mobile applications, but it helps to know that your tools are capable when it gets desperate.

Even back when the first line of code was dropped for Hybrid Mobile tooling, making the tools as part of the Eclipse foundation was a goal. When starting, we looked at the available tools for developing Cordova applications. We found out that there were no open source solutions that we could contribute and use as part of our tools. Furthermore, interoperability among what very little existed was poor. Of course, our main goal is creating good tools for Apache Cordova development, but while doing that we always keep an eye on interoperability and extendibility.

It is only natural that we are moving the development of our tools for Cordova based application development and forming the Eclipse THyM project. We hope that, as a vendor neutral non-profit organization, Eclipse foundation will encourage contributions and be the base for interoperable Cordova tooling.

What is contributed

Everything related to Cordova based development including the project management, plugin discovery, and support for iOS and Android excluding the Cordova simulator is contributed to Eclipse.org. We have excluded CordovaSim for now because of its complex set of dependencies

What is changing

The development will continue to happen on GitHub but on a repository owned by Eclipse foundation. The contributed code is already renamed, cleaned and on the new repository. If you are a contributor, or want to be one, please use https://github.com/eclipse/thym

We will use bugzilla, and thym-dev mailing list from now on as provided by Eclipse foundation. As expected project documentation is at the wiki. The builds will be running on eclipse.org build server instance.

What is NOT changing

JBoss tools will continue to have support for Cordova development. We will consume Thym project and extend them with more capabilities and integrate with other parts of the tools and technologies coming from projects such as Aerogear.

And of course our wish to create good tools for Apache Cordova development continues with a hope for better collaboration with other individuals and companies.

In this article, I’m happy to introduce you the OAuth authorization via Phonegap’s inAppBrowser plugin with CordovaSim.

I was inspired to write this blog after reading a great article about Google API OAuth with PhoneGap’s InAppBrowser by Michael Dellanoce. I also want to spill the beans about new CordovaSim’s features like: JavaFx web engine, hybrid app debugging and eclipse console logging, that will be available in Beta3 (but you can try them now from the nightly build 4.2.x update site).

Overview

OAuth is an open standard for authorization. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials. Designed specifically to work with Hypertext Transfer Protocol (HTTP), OAuth essentially allows access tokens to be issued to third-party clients by an authorization server, with the approval of the resource owner, or end-user. PhoneGap Developers use inAppBrowser’s API to show the OAuth consent page.

Demo

CordovaSim supports inAppBrowser plugin and handles OAuth authorization. Here is a short video with OAuth demo and brand-new CordovaSim’s features (source code is also taken from the Michael Dellanoce’s article):

How to give it a go?

The sample should work with JBoss Tools 4.2.0 Beta3 release and later versions.

  • Clone the demo project

  • File → Import → Import Cordova Project

  • Right-click on the project → Properties → Hybrid Mobile Engine → Download → 3.4.0 (select as default engine)

  • Create a Google Developers Console project

  • Copy and paste Client ID and Client secret to index.js (lines 80-81) of the hybrid project

  • Right-click on the project → Run As.. → Run with CordovaSim

A few things to notice here : first, the Hybrid Mobile Tools imports the project into Eclipse and configures the proper plugins without there being any Eclipse specfic setup in the project. This works because the project is following the conventions from Cordova CLI generated projects and the import wizard understands this.

Secondly, when using Java 8, you can connect the Chrome debugger to the CordovaSimulator (Right click → Debug on browser) allowing you to step through the code, introspect variables and so forth.

Conclusion

We are trying our best to make CordovaSim as good as possible. User feedback is what we are seeking for now. We are looking forward to hearing your comments / remarks!
Have fun!

Ilya Buziuk
@ilyabuziuk

JBoss Tools 4.29.0.Final for Eclipse 2023-09

by Stéphane Bouchet on Nov 02, 2023.

JBoss Tools 4.28.0.Final for Eclipse 2023-06

by Stéphane Bouchet on Jul 03, 2023.

JBoss Tools for Eclipse 2023-06M2

by Stéphane Bouchet on Jun 05, 2023.

JBoss Tools 4.27.0.Final for Eclipse 2023-03

by Stéphane Bouchet on Apr 07, 2023.

JBoss Tools for Eclipse 2023-03M3

by Stéphane Bouchet on Mar 10, 2023.

Looking for older posts ? See the Archived entries.
back to top