Tuesday, December 16, 2014

How to dial a phone number from Oracle Mobile Application Framework?

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:
<a href="tel:+1-800-555-1234">call this number</a>
The sample code is also available here: https://github.com/mjabali/PhoneSample 

Wednesday, October 22, 2014

New Oracle Mobile Application Framework (MAF) Academy Course

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.

In this FREE two-hour interactive online course you'll learn and master the design, architecture, interoperability and security of Oracle Mobile Application Framework based applications.

Hurry up and get yourself educated on the Oracle mobile application development framework.

Here is the link to the course: http://bit.ly/MAFCourse

Have fun!

Thursday, October 9, 2014

Working with Device Information in the Oracle Mobile Application Framework

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.

The source code is available here: https://github.com/mjabali/DeviceFeatures

Have fun!



Monday, August 4, 2014

Oracle Mobile Application Framework Hands-On Workshops

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.
 Click the city of interest below. 


See you at the workshop!

Wednesday, May 14, 2014

Mobile Emulation on Google Chrome

If you want to see what your web page will look like on a mobile device and also do debugging during development on your desktop, here is a very useful resource for you.

Google Chrome allows you to emulate different mobile devices, screen resolutions, user agents and things like touch screen, geolocation and the accelerometer.

To enable Mobile Emulation on Google Chrome, open the Developer Tools, go to Settings and enable "Show 'Emulation' view in the console drawer".



Then, press 'Esc' to bring up the Developer Tools console drawer and finally select the Emulation tab. You'll find four sections: Device, Screen, User Agent and Sensors.


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.
 
Have fun playing with the other features!
 
 

Tuesday, April 29, 2014

Mac OS X Boot, Sleep and Wake Time and Date

For several times I wondered what was the exact time my machine booted, woke up or slept. So, I did a little investigation to find out that's actually very simple to get those answers.

Using the Mac OS X Terminal, you can run the following commands:

 
- For System Boot Time, use: systcl -a | grep kern.boottime

You should get results similar to the picture below





- For System Sleep Time, use: sysctl -a | grep sleeptime

You should get results similar to the picture below  




- For System Wake Time, use: sysctl -a | grep waketime

You should get results similar to the picture below




I typically use the "uptime" command (just type uptime on the Mac OS X Terminal) to find out how long my machine has been powered on.

Lastly, you can get a short history of the machine boot using the "last reboot" command (just type last reboot on the Mac OS X Terminal) to get the last three boots of the system.


You can get the same information reviewing system log files but I think opening the terminal and typing a few commands easy enough to get the information you're looking for.

Friday, April 18, 2014

Debugging Oracle ADF Mobile Applications - Part I

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.

The ingredients are:

- Oracle JDeveloper 11.1.2.4.0
- XCode 5.1 (for the Simulator)
- Apple Safari

The setup is pretty straightforward and here is what you have to do:

On the iOS Simulator (works on iOS +6.x), go to Settings > Safari > Advanced > and make sure Web Inspector is turned ON.

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.




Happy debugging!





Saturday, February 22, 2014

An Introduction to Oracle Mobile Suite

Here is a quick overview and introduction to the Oracle Mobile Suite. There are basically four areas that the Oracle Mobile Suite helps with your mobile strategy:
  • Development of multichannel applications with Oracle Mobile Application Framework
  • Data and services integration across the enterprise with Oracle SOA Suite
  • Uniform information security across all layers of enterprise and mobile applications with Oracle Identity Management
  • Deployment and management (cloud and on premise) of multichannel applications with Oracle Cloud Application Foundation
The video below shows the core capabilities of the Oracle Mobile Suite and how can you benefit of it.


Wednesday, February 5, 2014

Getting Started with HTML5 WebSocket on Oracle WebLogic 12c

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;

@WebSocket(pathPatterns={"/echo/*"})
public class Echo extends WebSocketAdapter{

@Override
  public void onMessage(WebSocketConnection connection, String msg){
      try{
          connection.send(msg);
      }catch(IOException ioe){
          //Handle error condition
      }
  }

}

On the client side, you typically use the WebSocket JavaScript API that most of the web browsers already support.


There are many samples out there that you can use to test the implementation above. One quick way of doing that is to navigate to http://www.websocket.org/echo.html and then point the location field to your WebLogic server. If you follow the sample available on https://github.com/mjabali/HelloWorld_WebSocket then you'll end up with something like ws://localhost:7001/HelloWorld_WebSocket/echo/ for the WebSocket server application.

The sample client provided will be available at http://localhost:7001/HelloWorld_WebSocket/index.html after the WebLogic deployment. See the README.md file on GitHub for additional instructions.

Have fun!

Setting Up Local Environment for Developing Oracle Intelligent Bots Custom Components

Oh the joy of having a local development environment is priceless. For most cloud based solutions the story repeats itself being hard to tr...