Thursday May 16, 2013

Debugging ADF Mobile Apps on Devices using Native Tools

In-Depth Debugging Using Device Native Tools
In-Depth Debugging Using Native Tools and Devices

Hi, everyone:

As most of you are aware, ADF Mobile can hook into JDeveloper's Remote Debugging to support Java code debugging, such as setting breakpoints and stepping through the code interactively from an emulator or an actual device.  The steps to enable debugging are described in the latest ADF Mobile Developer Guide, and Shay also had a nice entry on how to enable debugging on Android.  The developer guide also contains details on how to enable more refined levels of logging, and view log output using either the Mac Console application or the Android Monitor application.  Let's explore how all this works in a bit more detail. 

Furthermore, log output to the Mac console may not display certain logging messages - for example ones coming from the embedded Java Virtual Machine.  This is due to some compatibility issues between Mac OS (Mountain Lion) and the log output mechanism.  In this article, we will also discuss how to properly output all logging messages and perform more in-depth debugging and analysis using device native tools, with the same capability that native application developers enjoy when debugging an application written in native code such as Objective C.

iOS Debugging Using Xcode Utilities

Unreliable logging from the Java Virtual Machine is a major issue with debugging ADF Mobile application on iOS devices or simulator.  The underlying cause is incompatibility issues with Java Virtual Machine running on the latest Mac OS (Mountain Lion).  Furthermore, it is difficult to debug on an actual device - necessary when debugging issues with invoking device services such as camera or GPS.  However, you can use Xcode and a tethered iOS device to display all logging messages from the device, ADF Mobile container, and the embedded JVM, while running the ADF Mobile application.  To do this, you will need:
  • A Mac running Moutain Lion or Lion
  • Latest version of Xcode - as of May 2013, the latest version is 4.6.2.  Latest version of Xcode is necessary to properly recognize devices running latest version of iOS, as older versions of Xcode cannot properly connect to the most recent version of the iOS.
    • One frequently asked question here is that ADF Mobile does not always officially support the latest version.  In general, officially supported version has been thoroughly tested by Oracle QA, and therefore is recommended for most development purposes.  However, the latest version of Xcode would typically be compatible - please check JDeveloper Forum for any reports of issues. 
    • If indeed ADF Mobile for some reason can't  use the latest Xcode version to deploy an application, you can still follow the steps below.   When you open the temporary Xcode project generated by JDeveloper, you would simply use the latest version of Xcode.  The rest of the instructions would still be valid.
  • Oracle JDeveloper and ADF Mobile
  • An iOS device
  • Obtain and install Apple iOS Developer Certificates and Provisioning Profiles.  When you deploy your ADF Mobile application, you must deploy in Debug Mode, using Developer Certificates and Provisioning Profile. 
Here is a short video of how to modify the temporary Xcode project and use Xcode utilities to display all logging messages from an ADF Mobile application running on a device.

Android Debugging Using Android Debug Monitor

Shay recently published a blog article on viewing logs and debugging on Android devices.    Debugging using an Android device using Android Debug Monitor is much simpler to set up.  There is no need to work with the temporary Android application project.  Instead, you will just need:
  • A PC, Mac, or Linux machine supported by the Android SDK
  • Latest version of Android SDK Tools - this refers to the set of tools and utilities that are part of the Android SDK.  Android Debug Monitor is part of that.
  • Oracle JDeveloper and ADF Mobile
  • An Android-based Device and associated device driver installed (for PC and Linux Machines)
    • Please note that the appropriate drivers on PC and Linux are typically needed for proper connection to the device.  If the machine cannot properly recognize the device, then debugging will not be possible.
In addition to what Shay discussed in his blog article, a couple of additional notes that might be useful if you are looking at logging messages outside the embedded Java Virtual Machine:
  • In the LogCat window, set the filter by application ID.  You would see all logging messages related to the application, which includes events coming from the native part of the application (i.e. container), Cordova, device services, etc. 
  • You can optionally set your application as a "Debugging Application" by going to your device Settings-Developer options-Select debug app, and then select the ADF Mobile application you want to debug.  All applications compiled in "Debug" mode will show up here.  This will allow you to select the ADF Mobile application process in the Android Debug Monitor app, and perform additional debugging - most likely much more info than you will ever want (or care) to know.
Please let us know if there are any issues or questions.


Joe Huang

Friday May 03, 2013

Why should you move to

Hi, everyone:

It's great to see our engineering team has come through and delivered a bunch of new functionality in just a few month, since the release of ADF Mobile in late October of last year.  As Shay blogged about the new features in the previous entry, there are plenty of reasons to move to the new version.  Many of developers in the ADF Mobile community has been looking for ways to push real time notification to ADF Mobile applications, or looking for ways to properly display file content on both iOS and Android devices. now provides these functionality.

One great fact about the new push notification support is that native capabilities are used.  This means you would leverage Apple Push Notification Service or Google Cloud Messaging Service to push notification to ADF Mobile applications.  There is no proprietary or specialized messaging application you would need to implement - you can directly communicate with these push notification services with any backend servers.

File display support is critical for any application that needs to display file content.  In the version of ADF Mobile, you would leverage a LocalHTML feature to display files on iOS devices, but there is no solution for Android.  If your application needs to display file content such as PDF or Word document, you should migrate to

Another great feature is "Application Archive" support.  This is a great re-usability feature for ISV or SI partners - partners can simply create an application archive that includes all application artifacts and re-use the application in different engagements.  For each individual customer, the SI partner or customer themselves can extend the application archive with new functionality, and deploy it within their enterprise.  This is also needed if the customer needs to sign the application with their own certificates and profiles, as needed by most third party Mobile Application Management packages.

Lastly, there are numerous performance enhancements  - for example enhancements around ListView performance.  

Instruction for migrating an application to is documented in the Migration Section of the ADF Release Note.

However, there are also a few other important reason to move to now - please review these carefully and see if they apply to you:

  • Apple has stated that, as of May 1st, 2013, all apps submitted to the app store must properly support the iPhone 5 form factor.  iPhone 5's screen size is 1136x680 pixels with a 16:9 ratio, where as previous iPhone screen size is 960x680 pixels with 4:3 ratio.  Similar to all apps developed before iPhone 5 was released, ADF Mobile apps developed using would be displayed in letter-boxed format.  This no longer meets the updated Apple UI Guidelines.  Therefore, if you are planning to submit an ADF Mobile application to the Apple AppStore, you must move to, which has proper support for the iPhone 5 form factor.
  • also adds support for iPad mini - allowing you to specify icons and splash screen for iPad Mini.
  • If you wish to test using iOS6 simulators that comes with Xcode 4.5 and above, then you must move to  There is a known issue with application unable to rotate even if the device is rotated.
  • JDeveloper and ADF Mobile have been certified to work with more recent mobile SDKs (i.e. Xcode 4.5/iOS 6 and latest Android development tools/SDK).  Therefore, if you wish to use these new SDKs, you should move to
  • There are many bugs fixed in - if you are currently encountering any bugs in version of ADF Mobile, check out this list of bug fixed.

On behalf of the entire ADF Mobile development team, we would like to THANK YOU for your continued support of ADF Mobile.  We would definitely like to hear from you.

Joe Huang

How to solve "Failed to locate the Google Cloud Messaging" in ADF Mobile deployment

If you are trying to deploy to an Android device with the new Oracle ADF Mobile release there is a good chance that you'll run into a situation where your deployment will fail with the message -

Failed to locate the Google Cloud Messaging for Android Library file named "gcm.jar"

Don't worry this is quite easy to resolve. All you need to do is download and install the "Google Cloud Messaging for Android Library" from the "Extras" section of your Android SDK Manager application.

Your android environment now requires that part because the new Oracle ADF Mobile support notification through the Google Cloud Messaging.

Once you download that addition you should be able to deploy without any problems.

Monday Apr 29, 2013

UK Oracle Users Group hosts ADF Mobile event

The UK Oracle Users Group is hosting an ADF Mobile specific SIG on May 21st in the London city office.  Topics include device integration, security, web service development for mobile and user experience.

Check this link for more information!

Seats are limited so register soon!

Wednesday Mar 06, 2013

Invoking custom Javascript from AMX pages

In this edition of the ADF Mobile blog I'll tackle a topic that many have asked about.  How to invoke a custom Javascript method from an AMX page.  We'll also cover how to call back to Java from the same Javascript method.

Adding the custom Javascript to your AMX

To include a javascript file to an AMX feature, you need to go to Content tab of the adfmf-feature.xml.  This lets you include a javascript or CSS file.  In this case, we'll be including our custom javacript file.

Invoking the Javascript from a Java handler

From any Java code, you can use a built in method of the AdfmfContainerUtilities utility class to invoke a Javascript method.  Here's an example:

        "doAlert", new Object[] {});

The above call invokes the "doAlert" method in the feature with featureid="feature1".  The last parameter is an array of parameters that will be sent to the method.   Here's an example of passing in 3 parameters:

         "doAlert", new Object[] {"arg1", new Integer(123), "arg3"});

Handling Parameters in your Javascript methods

You can access parameters in your Javascript method by simply using the "arguments" variable.  In the example we call the same doAlert function with different numbers of parameters to show this.

     // This method shows you how to use variable args 
    doAlert = function () {
        var args = arguments;
        var str = "doAlert, argCount:" + args.length + ", arguments:";

        for (x = 0;x < args.length;x++) {
            if (x > 0) {
                str += ", ";
            str += arguments[x];

Calling back to Java

You can invoke Java methods by using the call:"mobile.MyClass", "FetchCallback", URI, 
            onInvokeSuccess, onFail);

In this method, the first parameter is the fully qualified Java class with the package name.  The second parameter is the method to invoke.  The second to last parameter is the javascript callback to be invoked on success and the last parameter is the javascript callback to be invoked when the function fails.  Any parameters added between the method and success callback are passes as the parameters to the java method.  Here are the signatures for the success and failure callbacks:

    function onSuccess(request, response) {
       // Process any return values that comes back in the "response" parameter 
    function onFail(request, response)) {

This shouldn't be confused with the success and failure callbacks from PhoneGap method calls.  Those have a different signature and you should consult the PhoneGap documentation for details.

If you wanted to just set a value of an EL expression, you can use the following method call: { "name": "#{pageFlowScope.myVariable}", "value": "some value" }, 
                onSuccess, onFail); 

With this method, you can simply set the value of the EL expression.  Note that the first parameter is a complex parameter that contains a JSON snippet that has a name/value pair.  It has the usual success and failure callbacks. 

The full example is available here.


This blog is is dedicated to tips and tricks for developing, integrating, securing, and managing mobile applications using Oracle Mobile Platform. It is created and maintained by the Mobile Suite/Oracle ADF Mobile product development team.

Archive of past entries

Even More Mobile Development Blogs

Oracle A-Team Site - Mobile Related Entries

Code samples from the Community

Fusion Middleware Blogs


« April 2014