For an ADF mobile sample I needed to display a confirmation message upon successful upload of an image. Because I could not see how to do this from Java using the ADF Mobile popup dialog, I used JavaScript. The JavaScript function I called is part of PhoneGap, which is neat because this ensures I don't have to maintain custom JavaSCript code in my AMX page. To call the PhoneGap notification dialog, I added
to the AMX page. I added this script tag to the body section of the amx:panelPage component tag. Note that the relative addressing /../.../.../ in the JS reference is for AMX pages that are in the public_html folder. If your page is in a sub folder, you will need to add an extra "/.." for each folder
In my Java bean, which I called from a method binding, I used the ADF Mobile AdfmfContainerUtilities.invokeContainerJavaScriptFunction(...) call to invoke the PhoneGap "navigator.notification.alert" function
navigator.notification.alert(message, alertCallback,[title],[buttonName])
See: http://docs.phonegap.com/en/1.0.0/phonegap_notification_notification.md.html
The Java call is shown below:
AdfmfContainerUtilities.invokeContainerJavaScriptFunction( "adf.sample.mobile.PhotoUpload", "navigator.notification.alert", new Object[] {"Image uploaded: \n " + "File Name: "+fileName+"\n File Type: "+fileType,"", "Image Uploaded to Server", "Ok"});
Note the use of the object array to pass multiple arguments to the JavaScript function. The "adf.sample.mobile.PhotoUpload" string is the ADF Mobile feature Id of the feature that contains the AMX page with the JavaScript reference.
The result is shown in the image below:
Using the same technique you can call any other PhoneGap JavaScript function from ADF Mobile (and your custom JavaScripts as well)
See also:
http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/phgapfeatures.htm#BABJGDIG
http://docs.phonegap.com/en/1.0.0/index.html