public class AdfmfContainerUtilities
extends oracle.adf.model.datacontrols.device.BaseProxy
Constructor and Description |
---|
AdfmfContainerUtilities() |
Modifier and Type | Method and Description |
---|---|
static int |
getApplicationIconBadgeNumber()
Get current badge value of on application icon
|
static oracle.adfmf.framework.ApplicationInformation |
getApplicationInformation()
Gets
ApplicationInformation object containing the information
about the application. |
static FeatureInformation |
getFeatureById(String featureId)
Returns the feature information for the passed in feature id.
|
static FeatureInformation |
getFeatureByName(String featureName)
Returns the feature information for the passed in feature name.
|
static FeatureInformation[] |
getFeatures()
Gets an array of
FeatureInformation objects that provide
information about the features that are available in this session of the
MAF application and should be displayed on a custom springboard. |
static void |
gotoDefaultFeature()
Activates the default feature.
|
static void |
gotoFeature(String featureId)
Activates the feature with the given id.
|
static void |
gotoSpringboard()
Activates the springboard.
|
static void |
hideNavigationBar()
Hides navigation bar.
|
static void |
hideSpringboard()
Hides springboard.
|
static Object |
invokeContainerJavaScriptFunction(String featureId,
String methodName,
Object[] args)
Invokes a Javascript method with the given arguments on the specified
feature.
|
static Object |
invokeContainerMethod(String className,
String methodName,
Object[] args)
Invokes a native method on the specified class with the given arguments.
|
static void |
resetApplication(String message)
Reset the application
Calling this method will cause the application to be reset.
|
static void |
resetFeature(String featureId)
Resets the feature with the given id.
|
static void |
resetFeature(String featureId,
boolean gotoTheFeature)
Resets the feature with the given id and optionally navigates to that
feature.
|
static void |
sendEmail(java.util.HashMap options)
Display the device's e-mail interface, and optionally pre-populate
certain fields.
|
static void |
sendSMS(java.util.HashMap options)
Display the device's text messaging (SMS) interface, and optionally
pre-populate certain fields.
|
static void |
setApplicationIconBadgeNumber(int badge)
Set a badge on application icon
|
static void |
showNavigationBar()
Shows navigation bar.
|
static void |
showSpringboard()
Shows springboard.
|
public static int getApplicationIconBadgeNumber()
public static oracle.adfmf.framework.ApplicationInformation getApplicationInformation() throws AdfException
ApplicationInformation
object containing the information
about the application. This can be used to get the application name for a
custom springboard. Additional information such as vendor, version and
application id are provided as well.
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { ApplicationInformation ai = AdfmfContainerUtilities.getApplicationInformation(); ... } catch(AdfException e) { // handle the exception }
ApplicationInformation
object containing
application level metadata. This includes application name, vendor,
version and application id.AdfException
public static FeatureInformation getFeatureById(String featureId) throws AdfException
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { FeatureInformation fi = AdfmfContainerUtilities.getFeatureById("feature.id"); } catch(AdfException e) { // handle the exception }
featureId
- The id of the feature to retrieveAdfException
- If featureId is null, blank, invalid or
the logged in user is not authorized for the feature.public static FeatureInformation getFeatureByName(String featureName) throws AdfException
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { FeatureInformation fi = AdfmfContainerUtilities.getFeatureByName("feature.name"); } catch(AdfException e) { // handle the exception }
featureName
- Name of the feature to retrieveAdfException
public static FeatureInformation[] getFeatures() throws AdfException
FeatureInformation
objects that provide
information about the features that are available in this session of the
MAF application and should be displayed on a custom springboard.
These features have already been filtered by the evaluation of constraints.
These are the features that would normally be displayed on the default
springboard.
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { FeatureInformation[] fia = null; fia = AdfmfContainerUtilities.getFeatures(); for(int f = 0; f < fia.length; ++f) { FeatureInformation fi = fia[i]; ... } } catch(AdfException e) { // handle the exception }
FeatureInformation
objects each
representing a feature that is available. This will include the
feature id, the feature name, a path to the feature icon and a path
to the feature image. Normally a springboard will display the name
of the feature and the image for that feature.AdfException
public static void gotoDefaultFeature()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.gotoDefaultFeature(); } catch(AdfException e) { // handle the exception }
public static void gotoFeature(String featureId) throws AdfException
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.gotoFeature("feature.id"); } catch(AdfException e) { // handle the exception }
featureId
- The id of the feature to activateAdfException
- If featureId is null, blank, invalid or
the logged in user is not authorized for the feature.public static void gotoSpringboard()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.gotoSpringboard(); } catch(AdfException e) { // handle the exception }
public static void hideNavigationBar()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.hideNavigationBar(); } catch(Exception e) { // handle the exception }
public static void hideSpringboard()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.hideSpringboard(); } catch(Exception e) { // handle the exception }
public static Object invokeContainerJavaScriptFunction(String featureId, String methodName, Object[] args) throws AdfException
featureId
- The id of the feature on which to invoke the methodmethodName
- method nameargs
- array of arguments to be passed to methodAdfException
- (function() { if (!window.application) window.application = {}; application.testFunction = function() { var args = arguments; alert("APP ALERT " + args.length + " "); return "application.testFunction - passed"; }; })();
public void invokeApplicationJavaScriptFuntions(ActionEvent actionEvent) { AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {} ); AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {"P1"} ); AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {"P1", "P2"} ); }
APP ALERT 0 APP ALERT 1 APP ALERT 2
public static Object invokeContainerMethod(String className, String methodName, Object[] args)
className
- class name: Always specify fully qualified class name for both iOS and Android.
Example:
If className "MyPackage.MySubpackage.MyClass" is set, class MyClass is invoked on iOS, while
class MyPackage.MySubpackage.MyClass is invoked on Android.
methodName
- method nameargs
- array of arguments to be passed to methodpublic static void resetFeature(String featureId) throws AdfException
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.resetFeature("feature.id"); } catch(AdfException e) { // handle the exception }
featureId
- The id of the feature to resetAdfException
- If featureId is null, blank, invalid or
the logged in user is not authorized for the feature.public static void resetFeature(String featureId, boolean gotoTheFeature) throws AdfException
Example
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.resetFeature("feature.id", false); }catch(AdfException e) { // handle the exception }
featureId
- The id of the feature to resetgotoTheFeature
- Whether or not to navigate to the featureAdfException
- If featureId is null, blank, invalid or the logged in user is not
authorized for the feature.public static void sendEmail(java.util.HashMap options)
After this interface is displayed, user can choose to either send the e-mail or discard it. Note that it is not possible to automatically send the e-mail due to device/carrier restrictions; only the end user can actually send the e-mail. The device must also have at least one e-mail account configured to send e-mail; otherwise, an error will be displayed indicating that no e-mail accounts could be found.
Examples :
Populate an e-mail to 'john.doe@foo.com', copy 'jane.doe@bar.com', with
the subject 'Test message', and the body 'This is a test message'
HashMap options = new HashMap(); options.put("to", "john.doe@foo.com"); options.put("cc", "jane.doe@bar.com"); options.put("subject", "Test message"); options.put("body", "This is a test message"); AdfmfContainerUtilities.sendEmail(options);Taking the same example, but now adding a BCC to 'mary.may@another.com' and 'lary.day@another.com' and attaching two files.
HashMap options = new HashMap(); options.put("to", "john.doe@foo.com"); options.put("cc", "jane.doe@bar.com"); options.put("bcc", "mary.may@another.com,lary.day@another.com"); options.put("subject", "Test message"); options.put("body", "This is a test message"); options.put("attachments", "path/to/file1.txt,path/to/file2.png"); AdfmfContainerUtilities.sendEmail(options);
options
- is a HashMap object with the following optional properties:
AdfException
public static void sendSMS(java.util.HashMap options)
Example:
Populate an SMS message to '1234567890' with the body 'This is a
test message'
HashMap options = new HashMap(); options.put("to", "1234567890"); options.put("body", "This is a test message"); AdfmfContainerUtilities.sendSMS(options);
options
- is a HashMap object with the following optional properties:
AdfException
public static void setApplicationIconBadgeNumber(int badge)
badge
- the badge valuepublic static void showNavigationBar()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.showNavigationBar(); } catch(Exception e) { // handle the exception }
public static void showSpringboard()
Example :
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.showSpringboard(); } catch(Exception e) { // handle the exception }
public static void resetApplication(String message)
import oracle.adfmf.framework.api.AdfmfContainerUtilties; ... try { AdfmfContainerUtilities.restartApplication("New content is available."); } catch(Exception e) { // handle the exception }
message
- a message describing the reason the application is being restarted, or null if no message is required