public class MDApplication extends java.lang.Object implements IMDApplication
BLUETOOTH_SERVICE, DEVICE_AUTHENTICATOR_SERVICE, LOCATION_MANAGER_SERVICE, ORIENTATION_SERVICE, SOUND_SERVICE
Constructor and Description |
---|
MDApplication() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowUnsecureSSLConnectionForURL(java.lang.String theURL)
Disable full SSL security checking for this URL
|
void |
changeAppDirectionality(int direction)
Changes the application directionality.
|
void |
changeSize(int width,
int height)
Changes the dimensions of the main window.
|
void |
destroyApp()
Destroys the application.
|
void |
flushUpdates() |
IMDApplicationListener |
getApplicationListener()
Gets current @link
IMDApplicationListener |
java.lang.String |
getAppProperty(java.lang.String key)
Gets the application property
|
static MDApplication |
getInstance()
Gets the running application instance.
|
nUIWindowDisplay |
getMainWindow()
Override this method and provide main application window instance.
|
IPushNotificationListener |
getPushNotificationListener()
Gets current
IPushNotificationListener |
java.lang.Object |
getService(java.lang.Class clazz)
Returns a service instance for particular class
|
java.lang.Object |
getService(java.lang.String serviceName)
Returns a service instance for the particular service name.
|
void |
init()
This method is called just after creating
MDAppliction instance. |
boolean |
isRunningOnMDThread()
Checks if the current thread is the main one.
|
void |
pauseApp()
Pauses the application.
|
boolean |
platformRequest(java.lang.String url)
Sends request to the platform.
|
void |
resumeApp()
Resumes the application.
|
void |
runAsync(ICallable task,
IResultCallback callback)
Runs the given
task asynchronously. |
void |
runAsync(ICallable task,
IResultCallback callback,
boolean runCallbackOnMainThread)
Runs the given
task asynchronously. |
void |
runAsync(java.lang.Runnable task)
Runs the given
task asynchronously. |
void |
runAsync(java.lang.Runnable task,
IResultCallback callback)
Runs the given
task asynchronously. |
void |
runAsync(java.lang.Runnable task,
IResultCallback callback,
boolean runCallbackOnMainThread)
Runs the given
task asynchronously. |
void |
runOnMDThread(java.lang.Runnable task)
Runs task on the main MD thread.
|
void |
runOnMDThreadAndWait(java.lang.Runnable task)
Runs task on the main MD thread and waits until it has been executed.
|
void |
setApplicationIconBadgeNumber(int number)
Sets the badge number for the application.
|
IMDApplicationListener |
setApplicationListener(IMDApplicationListener listener)
Sets listener to receive Application events events.
|
IPushNotificationListener |
setPushNotificationListener(IPushNotificationListener listener)
Sets listener to receive Push Notification messages.
|
void |
startApp()
Starts the application.
|
public static MDApplication getInstance()
MDApplication
public nUIWindowDisplay getMainWindow()
nUIWindowDisplay
instance.public void init()
MDAppliction
instance.
It initializes main window and its content.
You can override this method to initialize some project specific resources.public void flushUpdates()
public IPushNotificationListener setPushNotificationListener(IPushNotificationListener listener)
IMDApplication
setPushNotificationListener
in interface IMDApplication
listener
- - to send PN messagespublic IPushNotificationListener getPushNotificationListener()
IMDApplication
IPushNotificationListener
getPushNotificationListener
in interface IMDApplication
IPushNotificationListener
or null
if it hasn't been set.public IMDApplicationListener setApplicationListener(IMDApplicationListener listener)
IMDApplication
setApplicationListener
in interface IMDApplication
listener
- - to send Application events to.public IMDApplicationListener getApplicationListener()
IMDApplication
IMDApplicationListener
getApplicationListener
in interface IMDApplication
IMDApplicationListener
or null
if it hasn't been set.public void startApp()
IMDApplication
startApp
in interface IMDApplication
public void pauseApp()
IMDApplication
pauseApp
in interface IMDApplication
public void resumeApp()
IMDApplication
resumeApp
in interface IMDApplication
public void destroyApp()
IMDApplication
destroyApp
in interface IMDApplication
public void changeSize(int width, int height)
IMDApplication
changeSize
in interface IMDApplication
public void changeAppDirectionality(int direction)
IMDApplication
changeAppDirectionality
in interface IMDApplication
direction
- - can be nUIConstants.TEXT_DIRECTION_LTR
or nUIConstants.TEXT_DIRECTION_RTL
public java.lang.String getAppProperty(java.lang.String key)
IMDApplication
getAppProperty
in interface IMDApplication
key
- - key for the requested propertypublic boolean platformRequest(java.lang.String url) throws javax.microedition.io.ConnectionNotFoundException
IMDApplication
platformRequest
in interface IMDApplication
url
- to process.javax.microedition.io.ConnectionNotFoundException
public void runAsync(java.lang.Runnable task, IResultCallback callback)
IMDApplication
task
asynchronously.runAsync
in interface IMDApplication
task
- - task to be executed in a new thread.callback
- - callback to notify callers task has been finished with success or not. This will be called on main thread, which can access UI elements.public void runAsync(java.lang.Runnable task)
IMDApplication
task
asynchronously.runAsync
in interface IMDApplication
task
- - task to be executed in a new thread.public void runAsync(ICallable task, IResultCallback callback, boolean runCallbackOnMainThread)
IMDApplication
task
asynchronously.runAsync
in interface IMDApplication
task
- - the task will be executed in a new thread.callback
- - is used to notify if task has been finished.runCallbackOnMainThread
- - if true, the callback will run on the main thread.public void runAsync(ICallable task, IResultCallback callback)
IMDApplication
task
asynchronously.runAsync
in interface IMDApplication
task
- - task to be executed in a new thread.callback
- - callback to notify callers task has been finished with success or not. This will be called on main thread, which can access UI elements.public void runAsync(java.lang.Runnable task, IResultCallback callback, boolean runCallbackOnMainThread)
IMDApplication
task
asynchronously.runAsync
in interface IMDApplication
task
- - the task will be executed in a new thread.callback
- - is used to notify if task has been finished.runCallbackOnMainThread
- - if true, the callback will run on the main thread, otherwise in the new created thread.public void runOnMDThread(java.lang.Runnable task)
IMDApplication
runOnMDThread
in interface IMDApplication
task
- - the task to execute.public void runOnMDThreadAndWait(java.lang.Runnable task)
IMDApplication
runOnMDThreadAndWait
in interface IMDApplication
task
- - the task to execute.public boolean isRunningOnMDThread()
IMDApplication
isRunningOnMDThread
in interface IMDApplication
public java.lang.Object getService(java.lang.Class clazz)
IMDApplication
getService
in interface IMDApplication
clazz
- - the requested service.public java.lang.Object getService(java.lang.String serviceName)
IMDApplication
getService
in interface IMDApplication
serviceName
- - the requested service.public void setApplicationIconBadgeNumber(int number)
number
- - number to set.public boolean allowUnsecureSSLConnectionForURL(java.lang.String theURL)
allowUnsecureSSLConnectionForURL
in interface IMDApplication
theURL
- true
if the URL may bypass SSL security checks.