Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


oracle.adf.model.datacontrols.device
Interface DeviceManager


public interface DeviceManager

Interface that defines access to device-specific functionality, such as camera and GPS. Java code should make use of this interface via DeviceManagerFactory.getInstance(). Internally, the DeviceDataControl also makes use of this interface to fulfill requests for device side functionality.


Field Summary
static int CAMERA_DESTINATIONTYPE_DATA_URL
           
static int CAMERA_DESTINATIONTYPE_FILE_URI
           
static int CAMERA_ENCODINGTYPE_JPEG
           
static int CAMERA_ENCODINGTYPE_PNG
           
static int CAMERA_SOURCETYPE_CAMERA
           
static int CAMERA_SOURCETYPE_PHOTOLIBRARY
           
static int CAMERA_SOURCETYPE_SAVEDPHOTOALBUM
           

 

Method Summary
 void clearWatchPosition(java.lang.String watchId)
          Stop receiving location updates by de-registering the location listener with specified watchId
 Contact createContact(Contact aContact)
          Save a previously-created Contact to the device's address book.
 Contact[] findContacts(java.lang.String contactFields, java.lang.String filter, boolean multiple)
          Enables retrieval of one or more Contact objects matching the specified criteria.
 int getAvailableScreenHeight()
          Get the height of the screen available for drawing controls, in pixels.
 int getAvailableScreenWidth()
          Get the width of the screen availble for drawing controls, in pixels.
 Location getCurrentPosition(int maximumAge, boolean enableHighAccuracy)
          Get the current position.
 java.lang.String getModel()
          Get the device's model number/ID
 java.lang.String getName()
          Get the device's name
 java.lang.String getNetworkStatus()
          Get the device's current network connectivity status
 java.lang.String getOs()
          Get the operating system that the application is running on
 java.lang.String getPhonegap()
          Get the version of PhoneGap in use by the ADF Mobile Framework
 java.lang.String getPicture(int quality, int destinationType, int sourceType, boolean allowEdit, int encodingType, int targetWidth, int targetHeight)
          Provides access to the device's default camera application, which enables taking a picture or retrieving a previously-saved image See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_camera_camera.md.html#camera.getPicture
 java.lang.String getPlatform()
          Get the device type that the application is running on
 double getScreenDiagonalSize()
          Get the size of the screen, measured on the diagonal in inches
 int getScreenDpi()
          Get the screen's pixel density, measured in dots per inch (DPI)
 int getScreenHeight()
          Get the width of the screen, in pixels.
 double getScreenScaleFactor()
          Get the scale factor to use when determining how to size user interface elements
 int getScreenWidth()
          Get the width of the screen, in pixels.
 java.lang.String getVersion()
          Get the operating system version number
 boolean hasAccelerometer()
          Does the device have an accelerometer?
 boolean hasCamera()
          Does the devie have a camera?
 boolean hasCompass()
          Does the device have a compass?
 boolean hasContacts()
          Does the device have an address book?
 boolean hasFileAccess()
          Does the device have access to the file system?
 boolean hasGeolocation()
          Does the device support geolocation services?
 boolean hasLocalStorage()
          Does the device have some kind of local storage (may not necessarily be the file system)
 boolean hasMediaPlayer()
          Is the device capable of playing back audio/video?
 boolean hasMediaRecorder()
          Is the device capable of recording audio/video?
 boolean hasTouchScreen()
          Does the device have a touchscreen?
 void removeContact(Contact aContact)
          Remove a contact from the address book See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_contacts_contacts.md.html#Contacts
 void sendEmail(java.lang.String to, java.lang.String cc, java.lang.String subject, java.lang.String body, java.lang.String bcc, java.lang.String attachments, java.lang.String mimeTypes)
          Display the operating system's default UI for sending an e-mail, and optionally pre-populate certain fields.
 void sendSMS(java.lang.String to, java.lang.String body)
          Display the operating system's default UI for sending a text message, and optionally pre-populate certain fields
 java.lang.String startUpdatingPosition(int updateInterval, boolean enableHighAccuracy, java.lang.String watchID, GeolocationCallback callback)
          Register a callback to receive regular updates on the device's position
 Contact updateContact(Contact aContact)
          Update an existing Contact object.

 

Field Detail

CAMERA_DESTINATIONTYPE_DATA_URL

static final int CAMERA_DESTINATIONTYPE_DATA_URL
See Also:
Constant Field Values

CAMERA_DESTINATIONTYPE_FILE_URI

static final int CAMERA_DESTINATIONTYPE_FILE_URI
See Also:
Constant Field Values

CAMERA_SOURCETYPE_PHOTOLIBRARY

static final int CAMERA_SOURCETYPE_PHOTOLIBRARY
See Also:
Constant Field Values

CAMERA_SOURCETYPE_CAMERA

static final int CAMERA_SOURCETYPE_CAMERA
See Also:
Constant Field Values

CAMERA_SOURCETYPE_SAVEDPHOTOALBUM

static final int CAMERA_SOURCETYPE_SAVEDPHOTOALBUM
See Also:
Constant Field Values

CAMERA_ENCODINGTYPE_JPEG

static final int CAMERA_ENCODINGTYPE_JPEG
See Also:
Constant Field Values

CAMERA_ENCODINGTYPE_PNG

static final int CAMERA_ENCODINGTYPE_PNG
See Also:
Constant Field Values

Method Detail

getCurrentPosition

Location getCurrentPosition(int maximumAge,
                            boolean enableHighAccuracy)
Get the current position.
Parameters:
maximumAge - - accept a cached value no older than this value, in milliseconds
enableHighAccuracy - - use the most accurate possible method of obtaining a location fix. Note this is just a hint; the operating system may not respect it
Returns:
Throws:
AdfException

startUpdatingPosition

java.lang.String startUpdatingPosition(int updateInterval,
                                       boolean enableHighAccuracy,
                                       java.lang.String watchID,
                                       GeolocationCallback callback)
Register a callback to receive regular updates on the device's position
Parameters:
updateInterval - - how often to retrieve the position in milliseconds.
enableHighAccuracy - - provides a hint that the application would like to receive the best possible results, even at increased power/computation expense (boolean)
watchID - - a unique identifier that can be used as a handle to subsequently stop listening for updates
callback - - An implementation of GeolocationCallback, which will be invoked at the specified updateInterval to deliver the device's location

clearWatchPosition

void clearWatchPosition(java.lang.String watchId)
Stop receiving location updates by de-registering the location listener with specified watchId
Parameters:
watchId - - an identifier previously used to register a GeolocationCallback

getName

java.lang.String getName()
Get the device's name
Returns:
a String like "iPhone Simulator" or "John Doe's iPhone"

getPlatform

java.lang.String getPlatform()
Get the device type that the application is running on
Returns:
a String like "iPhone Simulator" or "iPhone"

getVersion

java.lang.String getVersion()
Get the operating system version number
Returns:
a String like "4.3.2" or "5.0.1"

getOs

java.lang.String getOs()
Get the operating system that the application is running on
Returns:
a String like "iOS"

getModel

java.lang.String getModel()
Get the device's model number/ID
Returns:
a String like "iPhone3,1"

getPhonegap

java.lang.String getPhonegap()
Get the version of PhoneGap in use by the ADF Mobile Framework
Returns:
a String like "1.0.0"

hasCamera

boolean hasCamera()
Does the devie have a camera?
Returns:
true/false

hasContacts

boolean hasContacts()
Does the device have an address book?
Returns:
true/false

hasTouchScreen

boolean hasTouchScreen()
Does the device have a touchscreen?
Returns:
true/false

hasGeolocation

boolean hasGeolocation()
Does the device support geolocation services?
Returns:
true/false

getNetworkStatus

java.lang.String getNetworkStatus()
Get the device's current network connectivity status
Returns:
a String like "wifi", "2g", "unknown", "none"

getScreenWidth

int getScreenWidth()
Get the width of the screen, in pixels. Changes based on screen orientation.
Returns:
a number like 320 or 480

getScreenHeight

int getScreenHeight()
Get the width of the screen, in pixels. Changes based on screen orientation
Returns:
a number like 480 or 320

getAvailableScreenWidth

int getAvailableScreenWidth()
Get the width of the screen availble for drawing controls, in pixels. Changes based on screen orientation and other factors
Returns:
a number <= the screen width

getAvailableScreenHeight

int getAvailableScreenHeight()
Get the height of the screen available for drawing controls, in pixels. Changes based on screen orientation and other factors.
Returns:
a number <= the screen height

hasAccelerometer

boolean hasAccelerometer()
Does the device have an accelerometer?
Returns:
true/false

hasCompass

boolean hasCompass()
Does the device have a compass?
Returns:
true/false

hasFileAccess

boolean hasFileAccess()
Does the device have access to the file system?
Returns:
true/false

hasLocalStorage

boolean hasLocalStorage()
Does the device have some kind of local storage (may not necessarily be the file system)
Returns:
true/false

hasMediaPlayer

boolean hasMediaPlayer()
Is the device capable of playing back audio/video?
Returns:
true/false

hasMediaRecorder

boolean hasMediaRecorder()
Is the device capable of recording audio/video?
Returns:
true/false

getPicture

java.lang.String getPicture(int quality,
                            int destinationType,
                            int sourceType,
                            boolean allowEdit,
                            int encodingType,
                            int targetWidth,
                            int targetHeight)
Provides access to the device's default camera application, which enables taking a picture or retrieving a previously-saved image See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_camera_camera.md.html#camera.getPicture
Parameters:
quality - - Quality of saved image. Range is [0, 100]
destinationType - - Choose the format of the return value. 0 = DESTINATIONTYPE_DATA_URL = Return image as base64 encoded string 1 = DESTINATIONTYPE_FILE_URI = Return image as a filename URI, like "file:///absolute/path/to/image.png" DESTINATIONTYPE_FILE_URI is recommended to avoid exhausting device resources.
sourceType - - Where should the picture come from? 0 = SOURCETYPE_PHOTOLIBRARY = Device's photo library 1 = SOURCETYPE_CAMERA = Take a picture with the device's camera 2 = SOURCETYPE_SAVEDPHOTOALBUM = Device's saved photo album
allowEdit - - Allow simple editing of image before selection
encodingType - - Choose the encoding of the returned image file. 0 = ENCODING_TYPE_JPEG = JPEG image 1 = ENCODING_TYPE_PNG = PNG image
targetWidth - - Width in pixels to scale image. Must be used with targetHeight. Aspect ratio is maintained
targetHeight - - Height in pixels to scale image. Must be used with targetWidth. Aspect ratio is maintained
Returns:
a String representing either base64 image data or a file URI, depending on the value of destinationType

createContact

Contact createContact(Contact aContact)
Save a previously-created Contact to the device's address book. Note that you can create a Contact by simply instantiating one and setting its properties, but in order to persist it, you must call createContact. See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_contacts_contacts.md.html#Contacts
Parameters:
aContact - - a previously-constructed Contact object
Returns:
a Contact object. Note that you should always use the returned Contact object in subsequent operations, because this object will have the requisite primary key

removeContact

void removeContact(Contact aContact)
Remove a contact from the address book See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_contacts_contacts.md.html#Contacts
Parameters:
aContact - - the Contact object to remove

updateContact

Contact updateContact(Contact aContact)
Update an existing Contact object. Note that you can modify a Contact via its various properties and methods, but in order to persist the changes, you must call updateContact
Parameters:
aContact - - the modified Contact object to persist in the device's address book.
Returns:
- the modified Contact object

findContacts

Contact[] findContacts(java.lang.String contactFields,
                       java.lang.String filter,
                       boolean multiple)
Enables retrieval of one or more Contact objects matching the specified criteria. See PhoneGap documentation for more details: http://docs.phonegap.com/en/1.0.0/phonegap_contacts_contacts.md.html#contacts.find
Parameters:
contactFields - - comma-delimited list of field names to match on, e.g. "id,displayName,name,nickname,phoneNumbers,emails,addresses,ims,organizations birthday,note,photos,categories,urls". Note that categories is always null in the return value on iOS and Android devices.
filter - - search criteria. Note that the search criteria is matched against all fields specified in contactFields, so if you specify "John", a Contact object will be matched if any of the fields specified in contactFields (e.g. name OR address OR phoneNumber) contains the filter
Returns:
an array of Contact objects. Note that each Contact object will ONLY contain the fields you specified in the contactFields parameter; all others will be empty/null. See PhoneGap documentation for more details.

sendEmail

void sendEmail(java.lang.String to,
               java.lang.String cc,
               java.lang.String subject,
               java.lang.String body,
               java.lang.String bcc,
               java.lang.String attachments,
               java.lang.String mimeTypes)
Display the operating system's default UI for sending an e-mail, and optionally pre-populate certain fields.
Parameters:
to - - recipient list (comma-separated)
cc - - carbon copy recipient list (comma-separated)
subject - - subject line
body - - text of e-mail
bcc - - blind carbon copy recipient list (comma-separated)
attachments - - list of files to attach (comma-separated). Must be specified as absolute filenames; use AdfmfJavaUtilities.getDirectoryPathRoot() to help determine absolute filename.
mimeTypes - - list of MIME types, specified in the same order as the list of attachments. Specify null to let the system automatically determine MIME types for all attachments, or leave blanks in the comma-separated list to indicate the system should determine the MIME type only for those selected attachments. Example: attachments = "www/foo.txt,www/bar.png", mimetypes = "text/plain," means the first attachment is of type text/plain, but the system should automatically determine the MIME type for the second one.

sendSMS

void sendSMS(java.lang.String to,
             java.lang.String body)
Display the operating system's default UI for sending a text message, and optionally pre-populate certain fields
Parameters:
to - - recipient list (comma-separated)
body - - text of message

getScreenDpi

int getScreenDpi()
Get the screen's pixel density, measured in dots per inch (DPI)
Returns:
screen's pixel density, in dots per inch

getScreenScaleFactor

double getScreenScaleFactor()
Get the scale factor to use when determining how to size user interface elements
Returns:
scale factor

getScreenDiagonalSize

double getScreenDiagonalSize()
Get the size of the screen, measured on the diagonal in inches
Returns:
diagonal screen size, in inches

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


Copyright © 2012 Oracle. All Rights Reserved.