Tuesday, December 16, 2014

Sometimes you need to dial a number from within a mobile app and for my surprise that functionality was not directly exposed through the Oracle Mobile Application Framework APIs.

Oracle MAF provides a component called Link (Go) available under the General Controls palette that can be used for navigation between pages but it can also be used to enable linking to external URLs.

Using the tel: URL scheme with the Link (Go) component gives you the capability to dial phone numbers from within an Oracle Mobile Application Framework app.

So, here is how to do it:

On your MAF page, drag and drop a Link (Go) to the Panel Page and then set the URL in the component properties to the desired phone number. You can also use a Managed Bean to set the value if you want to do some processing before displaying the number to be called.

MAF Page source code after adding a Link (Go) component

Link (Go) component property panel

If you have mixed UI content on your Oracle MAF app and you want to get the same behavior on a HTML page you just need to add the following on your source code:

Wednesday, October 22, 2014

If you want to get into mobile application development with Oracle Mobile Application Framework (MAF), there is a new Oracle Developer Academy course available for you.

This new course includes an introduction to the Mobile Application Framework and teaches you how to design a MAF-based application, integrate with device capabilities, how to develop with web services and how to secure a MAF application.

Thursday, October 9, 2014

With the proliferation of new device models, form factors and operating systems, you may be thinking about the challenges to make your application work handle all of these different device properties information as there may be features that rely on specific characteristics or capabilities.

As an example, how frustrating it would be for the user trying to use a mapping feature if the device doesn't support geolocation? Or, just getting the device screen height and width to make sure the content fits nicely and also dynamically present different things on the smaller / larger real state you have available. As a developer, it's your responsibility to make sure everything works and looks good on all devices (even though this is a hard task).

The Oracle Mobile Application Framework (MAF) utilizes Apache Cordova to provide access to device properties, SMS, Email, Contacts, Camera, Pictures/Photo Library, Geolocation, Accelerometer, Network, etc. that can either be accessed from Java, JavaScript and Expression Languages in order to support these requirements on your mobile application.

Additionally, the most common functionality (sendEmail, getPicture, createContact, sendSMS, etc) is exposed as a Data Control and can be simply dragged-and-dropped onto an AMX page reducing the need for coding calls to the API and constructing the necessary screens.

The MAF documentation covers all in details but here is a list of what's currently supported by the framework (through the embedded Apache Cordova API):

device.name

device.platform

device.version

device.os

device.model

device.phonegap

hardware.hasCamera

hardware.hasContacts

hardware.hasTouchScreen

hardware.hasGeolocation

hardware.hasAccelerometer

hardware.hasCompass

hardware.hasFileAccess

hardware.hasLocalStorage

hardware.hasMediaPlayer

hardware.hasMediaRecorder

hardware.networkStatus

hardware.screen.width

hardware.screen.height

hardware.screen.availableWidth

hardware.screen.availableHeight

hardware.screen.dpi

hardware.screen.diagonalSize

hardware.screen.scaleFactor

Most of the property names are self-explanatory and I won't go into the details of each one of them but there is a demo available for you that shows how to get started and use some of the information that the framework provides. Screenshots on both platforms are available below so you can take a peek what it looks like:

iOS Simulator

Android Emulator

The demo itself uses EL (expression languages) to get the values and then present them in different ways on the AMX page including outputText, buttons, etc and also change the availability of the component based on the feature capability.

In summary, integrating the device features into a Oracle MAF application is easy and flexible, the declarative drag and drop support suits most of the use cases and you can get deeper control programatically.

Monday, August 4, 2014

We are kicking off the US-based series of the Oracle Mobile Application Framework hands-on workshops that are going to cover the details of the platform and get you started with Oracle mobile development in a heartbeat. By the way, this is a FREE event!

These are one-day workshops where you will get technical insights into the new product enhancements, see live demos, and best of all, get hands-on experience with mobile app development.

All you need to do is register for the workshop, pre-install/configure the development environment (MAF) on your laptop and you will be ready to go (don’t worry, we’ll send you detailed instructions on how to do this as well as contact information, should you need it). We also plan to set this up so that you can BYOD to test out your completed app (details will be provided in the invite).

Here are the links for the currently scheduled workshops so that you can register. If you don’t see your city listed be sure to send me an email letting me know where you would like to see a workshop added – we’re working to prioritize additional workshops now and your input will be valuable.

A quick test to understand this powerful feature can be done by simply navigating to www.google.com, select a device (i.e. Google Nexus 5) and then click Emulate. You'll be able to see that Google Chrome will show you the mobile optimized version of the Google website.

To go back to the original settings, just hit Reset and you'll see the regular Google Chrome rendering of the web page.

Friday, April 18, 2014

I've been involved with the Oracle Mobile Application Framework (a.k.a. ADF Mobile) lately and one of the things developers typically ask me during my talks is how to debug mobile applications created with the Oracle framework.

To give you a little bit of context, the Oracle Mobile Application Framework does generate a hybrid app (native container + HTML/JavaScript) so standard debugging techniques apply here. The Oracle Mobile Application Framework has some other capabilities like running Java code on the device but that's a topic for another post.

So, there is more than one way for debugging Oracle-generated (read hybrid) applications depending on the platform your are own and the target device you are working on. I'll try to isolate specific use cases on different posts so you don't get distracted with irrelevant stuff.

The first one on the list is debugging Oracle Mobile Applications on iOS and Mac OS X.

Open up the Safari web browser and enable the Develop features. To do that, go to Preferences > Advanced and check the Show Develop menu in the menu bar.

If you don't have an app deployed to the simulator yet, this is a good time to do so. Open up JDeveloper and deploy a simple application to the simulator (you can use the same approach with a real device but I'd rather start debugging on the simulator).

Once you have the app installed/deployed and running on your iOS simulator go to Safari and select the Develop menu.

You should see something similar to the picture below where you select the iPhone Simulator and then the name of your application (in my case - MyWeatherChannel). The below HTML pages are part of your application and highlighting one of them in the Safari menu will also highlight them on the iOS simulator.

Selecting that highlighted page will bring Safari's Web Inspector up. Click on the first icon on the left (Resources) and that should show you the DOM for the page you selected.

At this point, you have many options but you may want to try enabling the Styles (click on the Styles button on the top menu) and make changes to the existing components on the page. That would give a good idea on what to look for when doing further debugging.

You can also manipulate the DOM to change the name or size of the labels and see how they are going to look like.

What is also very interesting are the Timelines (click on the Timelines button on the top menu) where you can see how long it takes to make a network request, to load different components of your application and the details of JavaScript calls.

The last thing I'd like to show you here is the option to enable the Console (click on the Console button on the top menu) and you can many other things like triggering commands or watching the console output. You can also reload the application by pressing Cmd + R.

In the test above, I just fired an alert command (alert("My Test Message");) from the console and saw the JavaScript alert on the simulator.

You can also change the current values (by also manipulating the DOM) in the app like the example below where the command: document.getElementById("ot3").innerHTML=72; changes the value of one the fields in the app.

Wednesday, February 5, 2014

The current release of Oracle WebLogic (12.1.2) added support to HTML5 WebSocket (RFC-6455) providing the bi-directional communication over a single TCP connection between clients and servers. Unlike the HTTP communication model, client and server can send and receive data independently from each other.

The use of WebSocket is becoming very popular for highly interactive web applications that depend on time critical data delivery, requirements for true bi-directional data flow and higher throughput.

To initiate the WebSocket connection, the client sends a handshake
request to the server. The connection is established if the handshake
request passes validation, and the server accepts the request. When a
WebSocket connection is established, a browser client can send data to a
WebLogic Server instance while simultaneously receiving data from that
server instance.

The WebLogic server implementation has the following components:

The WebSocket protocol implementation that handles connection upgrades and establishes and manages connections as well as exchanges with the client. The WebLogic server fully implements the WebSocket protocol using its existing threading and networking infrastructure.

The WebLogic WebSocket Java API, through the weblogic.websocket package, allows you to create WebSocket-based server side applications handling client connections, WebSocket messages, providing context information for a particular WebSocket connection and managing the request/response handshake. For additional information about the WebLogic WebSocket Java API interfaces and classes, visit the following resource: http://docs.oracle.com/middleware/1212/wls/WLPRG/websockets.htm#BABJEFFD

To declare a WebSocket endpoint you use the @WebSocket annotation that allow you to mark a class as a WebSocket listener that's ready to be exposed and handle events. The annotated class must implement the WebSocketListener interface or extend from the WebSocketAdapter class.

When you deploy the WebSocket-based application on WebLogic, you basically follow the same approach using the standard Java EE Web Application archives (WARs), either as standalone or WAR module. Either way, the WebLogic Application Server detects the @WebSocket annotation on the class and automatically establishes it as a WebSocket endpoint.Here is a simple application that creates a WebSocket endpoint at the /echo/ location path, receives messages from the client and sends the same message back to the client.import weblogic.websocket.WebSocketAdapter;import weblogic.websocket.WebSocketConnection;import weblogic.websocket.annotation.WebSocket;