In a 3rd party app for BlackBerry, in some cases, you may want to launch the internal applications like Emails, SMS, AddressBook, etc. in the running process of your 3rd party app. There are two procedures I tried, in which the first one works (High Five to BlackBerry API) and the second one need to be hacked more (an interesting area to explore when you want some fun). In this article, we will make an example of getting access to Message Apps.
1. The Bright Road
BlackBerry API provides the class Invoke (in package net.rim.blackberry.api.invoke) which allows third-party applications to remotely invoke internal applications. The way how to use it is as follows:
Under Class Invoke, there is a method:
public static void invokeApplication
(int appType,applicationarguments args)
in this method, the parameter int appType has the following options:
APP_TYPE_ADDRESSBOOK
APP_TYPE_BLUETOOTH_CONFIG
APP_TYPE_CALCULATOR
APP_TYPE_CALENDAR
APP_TYPE_CAMERA
APP_TYPE_MAPS
APP_TYPE_MEMOPAD
APP_TYPE_MESSAGES
APP_TYPE_PHONE
APP_TYPE_SEARCH
APP_TYPE_TASKS
Here we use APP_TYPE_MESSAGES and an instance of MessageArguments class as parameters in this method.
What you need to do is, in your app procedure, you need to write this code in invokeLater(). Here is an example:
UiApplication.getUiApplication.invokeLater(new Runnable()
{
public void execute(){
Invoke.invokeApplication
(Invoke.APP_TYPE_MESSAGES, new MessageArguments(...));
}
});
[References]
http://www.blackberry.com/developers/docs/5.0.0api/net/rim/
blackberry/api/invoke/package-summary.html
2. The Dark but Adventurous Road
While in the Message App, write this code:
String URL = ApplicationDescriptor.currentApplicationDescriptor.
getModuleName+"?"+"saved";
ApplicationManager.getApplicationManager.launch(URL)
So far, what I know about the parameters in Message apps are 'saved' (which lead you to the saved messages folder), 'search' and 'searchinit'. I believe there are some non-revealed args like 'compose', 'reply', etc. to be found!
[Reference]
(1). ApplicationDescriptor:
http://www.blackberry.com/developers/docs/4.6.0api/net/rim/
device/api/system/ApplicationDescriptor.html
(2). ApplicationManager:
http://www.blackberry.com/developers/docs/4.6.0api/net/rim/
device/api/system/ApplicationManager.html
Hack it! Enjoy it!
0 comments:
Post a Comment