MAF Tips and Tricks

  • Installation:
    • Android SDK – Oracle Enterprise Linux (RHEL, Centos, etc)
      • Requires 32 bit libs: (android-sdks/build-tools/17.0.0/aapt:
      • error while loading shared libraries: libz.so.1:
      • cannot open shared object file: No such file or directory)
      • yum install ncurses-libs.i686 libstdc++.i686 libgcc.i686
      • Requires 32 bit libs: (error while loading shared libraries: libstdc++.so.6)
      • sudo yum install zlib.i686
      • Install Android SDK from Command Line

Given that the install commands each can take the package # as a parameter, which package number do you use? After much online searching and trial and error, I discovered that

android update sdk --no-ui --filter uses the package numbers from android list sdk
and
android update sdk -u -a -t uses the package numbers from android list sdk --all
In other words – to install API 23.1 revision 3 you can do either:
android update sdk --no-ui --filter 3
or
android update sdk -u -a -t 29

 

  • Running AMPA Tutorial:
    • Nasty Typo on page 2: /entity/Department/{id}/employeesList1  should be /entity/Department/{id}/employeeList1  – note it is employee without the S – the screen shot is correct, so watch the copy/paste here!

Build a Query Form and Display Results with ADF

Using OSB and SOA Suite in Mobile World

  •  Cordova Plugins:
    • Apache Cordova Plug ins
    • Add Cordova NFC Plug in
    • Using Plug Ins in MAF Apps (Docs)
    • GPS Detection
    • Network Detection using Cordova Plug in
    • Network Detections Options in MAF:
      • DeviceManager JavaDoc  isDeviceOnline\
      • Or:
        • If your use case is to check when the device goes from an offline state to an online state and vice-versa, then you should use the network information plugin directly.  See this site for info on the APIs.  Basically you can add a listener for “offline” and “online” and in the online event handler you can call checkConnection to get the type of connection.  This is much more efficient than having your own thread to periodically check it.  If you have specific need to disable some aspects of the UI based on the connection type, just use conditional EL based on the #{deviceScope.device.networkStatus} attribute which is dynamic.
      • Or: in EL:  #{deviceScope.hardware.networkStatus}

 

  • Remote URL access in MAF:
    • don’t think you have control over the on device browser. I think for the use case the remote URL feature Chris shows in the video is the preferred choice as it allows you to programmatically navigate to it and back from it. Note that a golink does not display the content of the remote URL as part of the AMX page. It either opens a browser or replaces the current MAX view with the content from the remote URL- In the latter case you are stuck as you wont find back easily.
    • From Docs: Example 20–2 <amx:goLink> with a url Parameter
    • Since it has code that shows calling the Remote URL from a goLink, and does not point out that there is no way to get back.
      I’ll go one step further and suggest the docs are suggesting an “anti-pattern” use case and instead should include a note indicating that the use of the Application Feature data control’s goToFeature() can/should be used to be able to get “back” to the AMX page feature and not the goLink. 
  • actually you can navigate MAF features from remote HTML. With MAF 2.1, add the following script tag to your remote server HTML to make the MAF JS API available
  •  
  •    <script type="text/javascript" src="/~maf.device~/www/js/base.js"></script>
  •  
  • You can then define a script function to navigate features
  •  
  •         <script type="text/javascript">
  •             function switchFeature(){
  •                 adf.mf.api.gotoDefaultFeature(
  •                 function(req, res) { alert("gotoDefaultFeature complete"); },
  •                 function(req, res) { alert("gotoDefaultFeature failed with");});
  •             }
  • You can use Cordova InAppBrowser Component, where you can open the external link inside the App and comes back.

    Streaming Video in AMX Page:

    2 Different options:
    1) Embed a streaming media component onto your page that connects to a remote streaming source – e.g. some HTML/JS component on a page (via verbatim or outputHTML in MAF) that provides this functionality.

 

2) First download the file locally and then use the displayFile to play it.

 

Method in the bean.
    public String getContent() {
        content+=”<video width=\”640\” height=\”360\” controls>\n” +
        ”               <source src=\”http://slc01fkd.us.oracle.com:1234/MAFVideos/video.mp4\” type=\”video/mp4\”/>\n” +
        ”           </video>”;
         return content;
    }
Within the amx just call the get method of the bean
 
 <amx:outputHtml security=”none” value=”#{HTMLBean.content}” id=”oh1″>